piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.17k stars 131 forks source link

Table name quoting #50

Closed Digenis closed 8 years ago

Digenis commented 8 years ago

Tables names that don't start with a letter or aren't alphanumeric need to be enclosed in double quotes.

tmylk commented 8 years ago

Thanks a lot for the PR!

piskvorky commented 8 years ago

CHANGELOG / tweet?

Btw @tmylk build fails -- related to repo move?

tmylk commented 8 years ago

@Digenis Test fails in Python 2.6 probably because asserts need to be backported

ERROR: Irregular table names need to be quoted

Traceback (most recent call last): File "/home/travis/build/RaRe-Technologies/sqlitedict/tests/test_core.py", line 148, in test_irregular_tablenames sqlitedict.SqliteDict, ':memory:', '"') File "/opt/python/2.6.9/lib/python2.6/contextlib.py", line 83, in helper return GeneratorContextManager(func(_args, *_kwds)) TypeError: assertRaisesRegexp() takes exactly 3 arguments (6 given)

Digenis commented 8 years ago

I just looked into it.

I thought that you should get a different traceback in 2.6 — it lacks assertRaisesRegexp. Then I noticed tests/accessories.py, it has an incomplete implementation of assertRaisesRegexp which can work only as a context manager.

I fixed it, you can git pull git@github.com:Digenis/sqlitedict.git master to avoid PR formalities. Commit: https://github.com/Digenis/sqlitedict/commit/c1e9ebd523f33480c5d58961a931cc01890bd9f6 Successful build: https://travis-ci.org/Digenis/sqlitedict/builds/139394023

Also, in python-3.something, it should warn about renaming it to assertRaisesRegex.

tmylk commented 8 years ago

Thx. Merged in https://github.com/RaRe-Technologies/sqlitedict/commit/bb212154844d11a22f9cff4bd7887483ae5b5cdb