I've had it on github for a while, but I finally released ddlgenerator to PyPI.
I've been frustrated for years that there was no good open-source way to set up RDBMS tables from flat data files. Sure, you could import the data - after setting up the DDL by hand. ddlgenerator handles that; in fact, you can go from zero, setting up and populating a table in a single line. Nothing up my sleeve:
$ psql -c "SELECT * FROM knights" ERROR: relation "knights" does not exist LINE 1: SELECT * FROM knights ^ $ ddlgenerator --inserts postgresql knights.yaml | psql CREATE TABLE INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 $ psql -c "SELECT * FROM knights" name | dob | kg | brave ------------+---------------------+---------+------- Lancelot | 0471-01-09 00:00:00 | 82.0000 | t Gawain | | 69.2000 | t Robin | 0471-01-09 00:00:00 | | f Reepacheep | | 0.0691 | t
This is a fairly complex tool so I'm sure you'll be using the bug tracker. But I hope you'll enjoy it nonetheless!
No comments:
Post a Comment