Skip to content

stateless tipg: remove collection_catalog  #37

@vincentsarago

Description

@vincentsarago

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions