Skip to content

Use sqlite-diffable as a Python module - #10

Open
PeskyPotato wants to merge 3 commits into
simonw:mainfrom
PeskyPotato:py_module
Open

PeskyPotato wants to merge 3 commits into
simonw:mainfrom
PeskyPotato:py_module

Conversation

@PeskyPotato

@PeskyPotato PeskyPotato commented Jul 6, 2024 •

Copy link
Copy Markdown

The pull list of changes are described in Issue #9, the summary can be found below:

  • Created wrapper functions for load, dump and object using click and sample code from this StackOverflow post.

  • Added tests for dumping one and two tables, and loading two tables.

@PeskyPotato

Copy link
Copy Markdown
Author

If all looks good, I wouldn't mind also updating the README to show some example usage instructions.

@HRtech-lab HRtech-lab left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Python wrapper loses the cause of a missing input file. In an empty directory, sqlite_diffable.dump('missing.db', 'out', all=True) returns False and prints You must set all to True or specify a list of tables, even though all=True was supplied. The equivalent CLI call identifies missing.db as the file that does not exist. Creating a database with one table and repeating the Python call returns True.

Could the wrapper preserve the original Click error, for example by reporting e.format_message() if the boolean return is part of the API? A missing-path test would distinguish this case from omitting the table selection.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants