Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
return feedback from cli and add basic error check to bcdata2pg
Browse files Browse the repository at this point in the history
  • Loading branch information
smnorris committed Jan 20, 2018
1 parent b9eddc5 commit 6c3ebb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pgdata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def cli(dataset, email, db_url):
"""Mirror a DataBC Catalogue dataset in postgres
"""
db = pgdata.connect(db_url)
db.bcdata2pg(dataset, email)
info = db.bcdata2pg(dataset, email)
click.echo(info['schema']+'.'+info['name'] + ' loaded')


if __name__ == '__main__':
Expand Down
6 changes: 6 additions & 0 deletions pgdata/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,9 @@ def bcdata2pg(self, url, email, table_name=None, schema='public',
schema=schema,
sql=sql,
dim=dim)

# check that all went well
if schema+'.'+table in self.tables:
return info
else:
raise IOError(schema+'.'+table+' was not loaded')

0 comments on commit 6c3ebb4

Please sign in to comment.