You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
load should handle case where database tables already exist #6
% sqlite-diffable load simonwillisonblog.db simonwillisonblog
Traceback (most recent call last):
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/bin/sqlite-diffable", line 33, in <module>
sys.exit(load_entry_point('sqlite-diffable', 'console_scripts', 'sqlite-diffable')())
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/simon/Dropbox/Development/sqlite-diffable/sqlite_diffable/cli.py", line 90, in load
db.execute(schema)
File "/Users/simon/.local/share/virtualenvs/sqlite-diffable-J1UjzcIN/lib/python3.10/site-packages/sqlite_utils/db.py", line 465, in execute
return self.conn.execute(sql)
sqlite3.OperationalError: table "blog_entry" already exists
That error should be neater - but there should also be options for running this against a previously created database.
I want to be able to run this in conjunction with sqlite-comprehend which adds its own tables - I don't want those tables to be deleted when I update the other tables using this tool.
Activity
simonw commentedon Jul 11, 2022
I'm going to add a
--replaceoption which drops and replaces any tables that already exist.simonw commentedon Jul 11, 2022
I want to be able to run this in conjunction with
sqlite-comprehendwhich adds its own tables - I don't want those tables to be deleted when I update the other tables using this tool.simonw commentedon Jul 11, 2022
Updated documentation: https://github.com/simonw/sqlite-diffable/blob/7d3cbc30c7868e772bb5d64a6f47686f76977a74/README.md#loading-a-database
Release 0.4