MerginMaps / MerginMaps/db-sync

GEODIFF: Error: Unable to prepare SQL statement

Open
#85 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
53
Forks
24
PR merge metrics
No merged PRs in 30d

Description

After lots of troubleshooting, I've gotten an error I can't seem to work around.

== starting mergin-db-sync daemon == version 1.1.2 ==
Logging in to Mergin...
Processing Mergin Maps project 'Cleveland-Metroparks/nr_test'
Connecting to the database...
Modified and base schemas already exist
Downloading version v1 of Mergin Maps project Cleveland-Metroparks/nr_test to /tmp/dbsync/nr_test
Error: diff failed!
GEODIFF: Error: Unable to prepare SQL statement in prepare() call (SQLITE3 error [1]: near ")": syntax error)
Error: Failed to create a copy of modified source for driver postgres

Traceback (most recent call last):
File "dbsync_daemon.py", line 63, in
main()
File "dbsync_daemon.py", line 33, in main
dbsync.dbsync_init(mc, from_gpkg=True)
File "/mergin-db-sync/dbsync.py", line 666, in dbsync_init
init(conn, mc, from_gpkg)
File "/mergin-db-sync/dbsync.py", line 551, in init
summary_modified = _compare_datasets("sqlite", "", gpkg_full_path, conn_cfg.driver,
File "/mergin-db-sync/dbsync.py", line 148, in _compare_datasets
_geodiff_create_changeset_dr(src_driver, src_conn_info, src, dst_driver, dst_conn_info, dst, tmp_changeset, ignored_tables)
File "/mergin-db-sync/dbsync.py", line 138, in _geodiff_create_changeset_dr
_run_geodiff([config.geodiff_exe, "diff", "--driver-1", src_driver, src_conn_info, "--driver-2", dst_driver, dst_conn_info, "--skip-tables", _tables_list_to_string(ignored_tables), src, dst, changeset])
File "/mergin-db-sync/dbsync.py", line 75, in _run_geodiff
raise DbSyncError("geodiff failed!\n" + str(cmd))
dbsync.DbSyncError: geodiff failed!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with dbsync.py lines 75, 138, and 148, then follow the traceback through lines 551 and 666. Inspect the geodiff command, especially the --skip-tables argument, and reproduce the SQLite-to-PostgreSQL diff for the reported project. Done means the sync no longer fails with the SQLite syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python, sqlite
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.