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

stateless tipg: remove collection_catalog #37

Open
vincentsarago opened this issue Mar 16, 2023 · 1 comment
Open

stateless tipg: remove collection_catalog #37

vincentsarago opened this issue Mar 16, 2023 · 1 comment
Assignees

Comments

@vincentsarago
Copy link
Member

Since the start of tifeature/timvt/tipg, we designed the application with having a list of the available collections/layers stored in the application State:

app.state.collection_catalog = await get_collection_index(app.state.pool, **kwargs)

This gave some advantages:

The collection_catalog is created at application startup

tipg/tipg/main.py

Lines 65 to 80 in 489f024

@app.on_event("startup")
async def startup_event() -> None:
"""Connect to database on startup."""
await connect_to_db(app, settings=postgres_settings)
await register_collection_catalog(
app,
schemas=db_settings.schemas,
exclude_schemas=db_settings.exclude_schemas,
tables=db_settings.tables,
exclude_tables=db_settings.exclude_tables,
function_schemas=db_settings.function_schemas,
exclude_function_schemas=db_settings.exclude_function_schemas,
functions=db_settings.functions,
exclude_functions=db_settings.exclude_functions,
spatial=db_settings.only_spatial_tables,
)
because we assumed it's a pretty costly process.

The problem then (as explained in developmentseed/eoAPI#55 (comment)) is when you have changed in the DB (e.g new table) it won't show up in the application because the catalog is now updated.

Proposal

  • remove collection_catalog
  • create a clean SQL function which will list the collections
  • the function should accept id (to return only one collection), limit, offset, spatial_filter and temporal_filter

cc @bitner

@bitner
Copy link
Contributor

bitner commented Mar 16, 2023

We will also need to take into account merging in the overrides that can come from environment variables.

I will note, that we can use the existing function right now to filter by collection by setting tables= and functions=.

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

No branches or pull requests

2 participants