Skip to content

Commit

Permalink
Clarify create_tables script (#1914)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwkaltz authored Jan 8, 2024
1 parent 9283d6c commit aad11b5
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pyramid_oereb/contrib/data_sources/standard/create_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,17 @@ def create_standard_tables():
options, args = parser.parse_args()
if not options.configuration:
parser.error('No configuration file set.')
if not options.sql_file:
parser.error('No sql filename specified.')

config_source = 'pyramid_oereb.contrib.data_sources.standard.sources.plr.DatabaseSource'
if options.sql_file is None:

append_to_sql = 'w' if options.append_to_sql else 'a'
with open(options.sql_file, append_to_sql) as sql_file:
create_tables_from_standard_configuration(
configuration_yaml_path=options.configuration,
source_class=config_source,
section=options.section,
c2ctemplate_style=options.c2ctemplate_style,
tables_only=options.tables_only
sql_file=sql_file
)
else:
append_to_sql = 'w' if options.append_to_sql else 'a'
with open(options.sql_file, append_to_sql) as sql_file:
create_tables_from_standard_configuration(
configuration_yaml_path=options.configuration,
source_class=config_source,
section=options.section,
c2ctemplate_style=options.c2ctemplate_style,
sql_file=sql_file
)

0 comments on commit aad11b5

Please sign in to comment.