Skip to content

Commit 7565741

Browse files
committed
adopt single database and output dir, removing sqlite
1 parent c9905cb commit 7565741

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

blocksequence/cli.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
@click.option('--source_db', envvar='SEQ_SOURCE_DB', help="Source database name")
2222
@click.option('--source_user', envvar='SEQ_SOURCE_USER', help="Source DB username")
2323
@click.option('--source_pass', envvar='SEQ_SOURCE_PASS', help="Source DB password")
24-
@click.option('--outdb', envvar='SEQ_OUTPUT', default='.',
24+
@click.option('--out', envvar='SEQ_OUTPUT', default='.',
2525
type=click.Path(dir_okay=True, file_okay=False, resolve_path=True),
26-
help="Output SQLite database filename")
26+
help="Output directory for data files")
2727
@click.pass_context
28-
def main(ctx, source_host, source_db, source_user, source_pass, outdb):
28+
def main(ctx, source_host, source_db, source_user, source_pass, out):
2929
"""Sequence a road network through a geography to aid in enumeration."""
3030

3131
logger.debug("cli.main start")
@@ -34,10 +34,8 @@ def main(ctx, source_host, source_db, source_user, source_pass, outdb):
3434
ctx.ensure_object(dict)
3535

3636
# initiate the source and output database connections and store those in the context
37-
logger.debug("Source DB: {} as {} on {}".format(source_db, source_user, source_host))
38-
src_conn = create_engine('postgresql://{user}:{password}@{host}/{db}'.format(db=source_db, user=source_user, password=source_pass, host=source_host))
39-
logger.debug("Output DB: {}".format(outdb))
40-
dest_conn = create_engine('sqlite:///{}'.format(outdb), echo=False)
37+
logger.debug(f"DB: {source_db} as {source_user} on {source_host}")
38+
conn = create_engine(f'postgresql://{source_user}:{source_pass}@{source_host}/{source_db}')
4139

4240
# configure logging on the database engine to match our logger
4341
# sqlalchemy returns full results with debug, so avoid going to that level
@@ -48,8 +46,7 @@ def main(ctx, source_host, source_db, source_user, source_pass, outdb):
4846

4947
# attach DB information to the context
5048
ctx.obj = {
51-
'src_db': src_conn,
52-
'dest_db': dest_conn
49+
'db': conn,
5350
}
5451

5552
logger.debug("cli.main end")

0 commit comments

Comments
 (0)