Skip to content

Add --create-missing-collections option to load_queryables #370

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emmanuelmathot
Copy link
Contributor

This PR adds a new option --create-missing-collections to the load_queryables command that automatically creates missing collections rather than failing.

Changes:

  • Added new optional parameter create_missing_collections
  • When enabled, non-existent collections are created with valid STAC metadata
  • Uses proper transaction handling for database operations
  • Added comprehensive test coverage
  • Created collections include required STAC fields and global extent

@@ -147,6 +151,59 @@ def load_queryables(
queryables_data = item
break # We only need the first item

# Create missing collections if requested
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Create missing collections if requested
# Create missing collections if requested

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emmanuelmathot I think it makes sense to have a generic SQL create_empty_collections function. Right now, you've got some slight SQL injection vulnerabilities in there (f strings and SQL are not good friends). Do you mind if I push some changes to this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants