NOTE: The information on this post may be outdated. We recommend looking into the up-to-date documentation at trac (internal) and ReadTheDocs.
The astrodbkit package can be used to modify an existing SQL database (such as The BDNYC Database) but it can also be used to create and populate a SQL database from scratch.
To do this, import the BDdb module and create a new database with
from astrodbkit import astrodb
dbpath = '/path/to/new_database.db'
Then load your new database with
db = astrodb.Database(dbpath)
and start adding tables! The
db.table() method accepts as its arguments the table name, list of field names, and list of data types like so:
db.table('my_new_table', ['field1','field2'], ['INTEGER','TEXT'], new_table=True)
new_table=True is necessary to create a new table. Otherwise, it looks for an existing table to modify (which you could do as well!).
To populate your new database with data, read the documentation here or a summary at Adding Data to the BDNYC Database.
As always, I recommend the SQLite Browser for a nice GUI to make changes outside of the command line.