From a968b7298d7c1454747270062f97d3d20ab9a649 Mon Sep 17 00:00:00 2001 From: Matt Diez Date: Thu, 29 Aug 2024 16:09:29 -0500 Subject: [PATCH] Switched to --- docs/src/user_guide/configuration.md | 2 +- tipg/collections.py | 2 +- tipg/settings.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/user_guide/configuration.md b/docs/src/user_guide/configuration.md index e4bf326..b23e66f 100644 --- a/docs/src/user_guide/configuration.md +++ b/docs/src/user_guide/configuration.md @@ -84,6 +84,7 @@ prefix: **`TIPG_`** - **TABLE_CONFIG_ _ {schemaId}_{tableId} _ _DATETIMECOL** (str): Table's datetime column name - **TABLE_CONFIG_ _ {schemaId}_{tableId} _ _PK** (str): Table's primary key - **TABLE_CONFIG_ _ {schemaId}_{tableId} _ _PROPERTIES** (list of string): Select specific properties from table (for filtering and output) +- **SORT_COLUMNS** (bool): Sort the `columns` for a table alphabetically. Default is `True`. ```bash TIPG_TABLE_CONFIG__pgstac_items__PK=id @@ -129,7 +130,6 @@ prefix: **`TIPG_`** - **DEFAULT_FEATURES_LIMIT** (int): Set the default `Limit` values for `/items` endpoint. Default is `10` - **MAX_FEATURES_PER_QUERY** (int): Set the maximum number of features the `/items` endpoint can return. Default is `10000`. -- **SORT_COLUMNS** (bool): Sort the `columns` for a feature alphabetically. Default is `True`. ```bash TIPG_DEFAULT_FEATURES_LIMIT=1000 TIPG_MAX_FEATURES_PER_QUERY=2000 diff --git a/tipg/collections.py b/tipg/collections.py index e6529fc..b003f77 100644 --- a/tipg/collections.py +++ b/tipg/collections.py @@ -952,7 +952,7 @@ async def get_collection_index( # noqa: C901 # Make sure that any properties set in conf exist in table columns = table.get("properties", []) - if features_settings.sort_columns: + if table_settings.sort_columns: columns = sorted(columns, key=lambda d: d["name"]) properties_setting = table_conf.properties or [c["name"] for c in columns] diff --git a/tipg/settings.py b/tipg/settings.py index 20058ac..d14933a 100644 --- a/tipg/settings.py +++ b/tipg/settings.py @@ -62,7 +62,8 @@ class TableSettings(BaseSettings): fallback_key_names: List[str] = ["ogc_fid", "id", "pkey", "gid"] table_config: Dict[str, TableConfig] = {} - + sort_columns: bool = True + model_config = { "env_prefix": "TIPG_", "env_file": ".env", @@ -86,7 +87,6 @@ class FeaturesSettings(BaseSettings): default_features_limit: int = Field(10, ge=0) max_features_per_query: int = Field(10000, ge=0) - sort_columns: bool = True model_config = {"env_prefix": "TIPG_", "env_file": ".env", "extra": "ignore"}