'Connect to database and create tables.
Parameters
txn : sa.engine.Connection, optional
The transaction to execute in. If this is not provided, a new
transaction will be started with the engine provided.
Returns
metadata : sa.MetaData
The metadata that describes the new assets db.'

def init_db(self, txn=None):

    with ExitStack() as stack:
        if (txn is None):
            txn = stack.enter_context(self.engine.begin())
        tables_already_exist = self._all_tables_present(txn)
        metadata.create_all(txn, checkfirst=True)
        if tables_already_exist:
            check_version_info(txn, version_info, ASSET_DB_VERSION)
        else:
            write_version_info(txn, version_info, ASSET_DB_VERSION)
