Fix query parameters for entities queries
Fixes queries failing when using new sqlite exports + entities.
STR:
- download the last export from Agenda bessin
- run
arkindex export agenda-bessin-20230221-112834.sqlite csv --output 1965.csv --type page --recursive --parent ab78e813-1271-4203-ad4f-21b8fd1035ea --with-entities --entities-worker-version 095eb05c-87e5-4482-a23b-cfbe4bb4cbcf
Crash
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/solene/Documents/Projects/Bessin/export/.env/bin/arkindex:11 in <module> │
│ │
│ 8 if __name__ == '__main__': │
│ 9 │ sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) │
│ 10 │ sys.exit( │
│ ❱ 11 │ │ load_entry_point('arkindex-cli', 'console_scripts', 'arkindex')() │
│ 12 │ ) │
│ 13 │
│ │
│ /home/solene/Documents/Projects/Bessin/export/cli/arkindex_cli/cli.py:71 in main │
│ │
│ 68 │ if "func" in args: │
│ 69 │ │ # Run the subcommand's function │
│ 70 │ │ try: │
│ ❱ 71 │ │ │ status = args.pop("func")(**args) │
│ 72 │ │ │ parser.exit(status=status) │
│ 73 │ │ except KeyboardInterrupt: │
│ 74 │ │ │ # Just quit silently on ^C instead of displaying a long traceback │
│ │
│ /home/solene/Documents/Projects/Bessin/export/cli/arkindex_cli/commands/export/csv.py:179 in run │
│ │
│ 176 │ if with_entities: │
│ 177 │ │ print(database_path, parent, type, entities_worker_version, entities_recursive) │
│ 178 │ │ et_columns = entity_type_columns( │
│ ❱ 179 │ │ │ database_path, parent, type, entities_worker_version, entities_recursive │
│ 180 │ │ ) │
│ 181 │ │ csv_header = csv_header + et_columns │
│ 182 │
│ │
│ /home/solene/Documents/Projects/Bessin/export/cli/arkindex_cli/commands/export/db.py:877 in │
│ entity_type_columns │
│ │
│ 874 │ │ ) subquery GROUP BY name; │
│ 875 │ """ │
│ 876 │ │
│ ❱ 877 │ cursor.execute(query, params) │
│ 878 │ result = cursor.fetchall() │
│ 879 │ │
│ 880 │ if result is None: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯