Skip to content

Commit

Permalink
Fixes #1562
Browse files Browse the repository at this point in the history
  • Loading branch information
jwkaltz committed Dec 26, 2023
1 parent 0e166c3 commit 968536a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pyramid_oereb/contrib/data_sources/create_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def create_main_schema_tables():
def create_theme_tables():
parser = optparse.OptionParser(
usage='usage: %prog [options]',
description='Create all content for the standard database'
description='Create theme tables SQL'
)
parser.add_option(
'-c', '--configuration',
Expand Down Expand Up @@ -241,11 +241,20 @@ def create_theme_tables():
default=False,
help='Is the yaml file using a c2ctemplate style (starting with vars)'
)
parser.add_option(

Check warning on line 244 in pyramid_oereb/contrib/data_sources/create_tables.py

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/data_sources/create_tables.py#L244

Added line #L244 was not covered by tests
'--config-source',
type='string',
default='pyramid_oereb.contrib.data_sources.standard.sources.plr.DatabaseSource',
help='Config source to use, e.g. DatabaseSource, DatabaseOEREBlexSource, etc.'
'Note: parameter must match the actual config'
)
options, args = parser.parse_args()
if not options.configuration:
parser.error('No configuration file set.')
if not options.theme:
parser.error('No theme code specified.')
if not options.sql_file:
parser.error('No sql filename specified.')

Check warning on line 257 in pyramid_oereb/contrib/data_sources/create_tables.py

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/data_sources/create_tables.py#L256-L257

Added lines #L256 - L257 were not covered by tests

if Config.get_config() is None:
Config.init(
Expand All @@ -258,15 +267,10 @@ def create_theme_tables():
if theme_config is None:
parser.error('Specified theme not found in configuration.')

if options.sql_file is None:
with open(options.sql_file, 'w') as sql_file:

Check warning on line 270 in pyramid_oereb/contrib/data_sources/create_tables.py

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/data_sources/create_tables.py#L270

Added line #L270 was not covered by tests
create_theme_tables_(
theme_config,
tables_only=options.tables_only
options.config_source,
tables_only=options.tables_only,
sql_file=sql_file
)
else:
with open(options.sql_file, 'w') as sql_file:
create_theme_tables_(
theme_config,
tables_only=options.tables_only,
sql_file=sql_file
)

0 comments on commit 968536a

Please sign in to comment.