Description
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'])