Revision 319de05d5fbebbebb47532209490a2f8380f5343 authored by Valentin Lorentz on 10 August 2020, 19:33:00 UTC, committed by Valentin Lorentz on 10 August 2020, 19:48:37 UTC
Before this commit, python-cassandra used the default row factory,
which creates anonymous named tuple on each query, which makes it
impossible to type CqlRunner properly.

This commit replaces the row factory with dict_factory, which creates
only dicts, and converts them to well-defined dataclasses.
Additionally, this stop leaking python-cassandra internals to
cassandra.storage.

This also has some great side-effects:

* methods of CqlRunner are now consistent with each other (eg. _add_one
  methods used to be a mix of objects, dictionaries, and taking each value
  as argument)
* it will allow me to deduplicate more codes in further commits (I
  already deduplicated insertions methods to use self._add_one, as
  it was meant on the initial write of this class)
* CqlRunner no longer needs to define lists with column names, they are
  automatically detected from the dataclasses
1 parent 7d332f5
History
File Mode Size
bin
docs
sql
swh
.gitignore -rw-r--r-- 136 bytes
.pre-commit-config.yaml -rw-r--r-- 1.1 KB
AUTHORS -rw-r--r-- 112 bytes
CODE_OF_CONDUCT.md -rw-r--r-- 3.3 KB
CONTRIBUTORS -rw-r--r-- 46 bytes
LICENSE -rw-r--r-- 34.3 KB
MANIFEST.in -rw-r--r-- 242 bytes
Makefile -rw-r--r-- 163 bytes
Makefile.local -rw-r--r-- 69 bytes
README.md -rw-r--r-- 4.6 KB
conftest.py -rw-r--r-- 294 bytes
mypy.ini -rw-r--r-- 1.2 KB
pyproject.toml -rw-r--r-- 39 bytes
pytest.ini -rw-r--r-- 392 bytes
requirements-swh-journal.txt -rw-r--r-- 19 bytes
requirements-swh.txt -rw-r--r-- 71 bytes
requirements-test.txt -rw-r--r-- 318 bytes
requirements.txt -rw-r--r-- 117 bytes
setup.cfg -rw-r--r-- 247 bytes
setup.py -rwxr-xr-x 2.5 KB
tox.ini -rw-r--r-- 661 bytes

README.md

back to top