Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify create_tables script #1914

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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.')

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

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/data_sources/standard/create_tables.py#L63-L64

Added lines #L63 - L64 were not covered by tests

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:

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

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/data_sources/standard/create_tables.py#L68-L69

Added lines #L68 - L69 were not covered by tests
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
)
Loading