peter-wangxu / persist-queue

A thread-safe disk based persistent queue in Python
BSD 3-Clause "New" or "Revised" License
335 stars 50 forks source link

Add mysql support #174

Closed peter-wangxu closed 2 years ago

peter-wangxu commented 3 years ago

Keeps same behavior comparing with sqlite3 based SQLiteQueue Fixes #173

KillahB33 commented 3 years ago

Hey Peter, here is what my update looks like in the SQLBase.

    def _count(self):
        sql = 'SELECT COUNT({}) FROM {}'.format(
            self._key_column, self._table_name
        )
        row = self._getter.execute(sql).fetchone()
        commit_ignore_error(self._getter)
        return row[0] if row else 0

I have tested it, and it's working. Though I don't know if it will break the other queues

imidoriya commented 2 years ago

I'll try to review this week. Sorry for the delay.

codecov[bot] commented 2 years ago

Codecov Report

Merging #174 (ed37d0a) into master (d6ed33d) will decrease coverage by 0.15%. The diff coverage is 92.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
- Coverage   94.05%   93.90%   -0.16%     
==========================================
  Files          15       17       +2     
  Lines        1784     2133     +349     
  Branches      195      225      +30     
==========================================
+ Hits         1678     2003     +325     
- Misses         66       83      +17     
- Partials       40       47       +7     
Flag Coverage Δ
python 93.90% <92.24%> (-0.16%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
persistqueue/common.py 77.77% <ø> (ø)
persistqueue/exceptions.py 75.00% <ø> (ø)
persistqueue/serializers/json.py 100.00% <ø> (ø)
persistqueue/serializers/pickle.py 88.23% <ø> (ø)
persistqueue/serializers/msgpack.py 73.91% <50.00%> (-6.09%) :arrow_down:
persistqueue/mysqlqueue.py 84.37% <84.37%> (ø)
persistqueue/sqlbase.py 90.72% <88.19%> (-4.59%) :arrow_down:
persistqueue/tests/test_mysqlqueue.py 99.01% <99.01%> (ø)
persistqueue/__init__.py 73.33% <100.00%> (+1.90%) :arrow_up:
persistqueue/pdict.py 98.03% <100.00%> (+0.03%) :arrow_up:
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d6ed33d...ed37d0a. Read the comment docs.