Skip to content
Merged
Changes from 1 commit
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
17 changes: 13 additions & 4 deletions planemo/galaxy/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,19 @@ def _create_profile_local(ctx, profile_directory, profile_name, kwds):
if database_type not in ["sqlite", "postgres_singularity"]:
database_source = create_database_source(**kwds)
database_identifier = _profile_to_database_identifier(profile_name)
database_source.create_database(
database_identifier,
)
database_connection = database_source.sqlalchemy_url(database_identifier)
try:
database_source.create_database(
database_identifier,
)
except RuntimeError as e:
# If postgres database creation fails (e.g., role doesn't exist, connection issues),
# fall back to sqlite
ctx.log(f"Failed to create postgres database: {e}. Falling back to sqlite.")
database_type = "sqlite"
database_location = os.path.join(profile_directory, "galaxy.sqlite")
database_connection = DATABASE_LOCATION_TEMPLATE % database_location
else:
database_connection = database_source.sqlalchemy_url(database_identifier)
elif database_type == "postgres_singularity":
database_connection + database_source.sqlalchemy_url(database_identifier)
else:
Expand Down
Loading