Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite-diffable callable as a library #9

Open
PeskyPotato opened this issue May 4, 2024 · 1 comment
Open

sqlite-diffable callable as a library #9

PeskyPotato opened this issue May 4, 2024 · 1 comment

Comments

@PeskyPotato
Copy link

I've been using this package to build my website for a while and it's been absolutely great! I normally call the package through the CLI as intended but recently created callable function to consolidate the build into one Python script, which has been working so far.

Using the sample code from StackOverflow user Massimo Frasson, I built wrapper functions to call the load and dump click commands replicating all functionality as a proof of concept. These can be found on my fork under the py_module branch.

I've only done two commands as mentioned, and left object out as I don't use that. I think my error handling could also be better and I've not included any tests. I'm sharing this here in case it might help anyone else build or implement the same if it's of interest.

Example usage:
Load
replace defaults to False.

sqlite_diffable.load('posts.db', './content/posts/', replace=True)

Dump
all defaults to False.

sqlite_diffable.dump('posts.db', './content/posts/', all=True)

tables can be set within an array.

sqlite_diffable.dump('posts.db', './content/posts/', tables=['tags', 'categories'])
@PeskyPotato
Copy link
Author

Added the objects function in commit: 8014dbe
Added simple tests in commit: 8865ebf

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

No branches or pull requests

1 participant