Skip to content

Commit

Permalink
Better refactor of create_local_datasource() (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
plimkilde authored Jun 8, 2023
1 parent b22e104 commit 782b984
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions qc/db/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,14 @@ def create_local_datasource(name=None, overwrite=False):
if overwrite:
drv.DeleteDataSource(name)
data_source = None

print("Creating local data source for reporting.")
data_source = drv.CreateDataSource(name, FALL_BACK_DSCO)
else:
try:
data_source = ogr.Open(name, True)
except RuntimeError:
data_source = None
if data_source is None:
print("Creating local data source for reporting.")
data_source = drv.CreateDataSource(name, FALL_BACK_DSCO)
create_layers(data_source, None)
return data_source

Expand Down

0 comments on commit 782b984

Please sign in to comment.