You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add load_queryables function and support for collection IDs; update documentation and examples
* refactor: update load_queryables to accept a list for collection IDs; adjust example and tests accordingly
* feat: add delete_missing option to load_queryables; update examples and tests
* docs: update load_queryables documentation to reflect new syntax and delete_missing option
* feat: add index_fields option to load queryables for customizable indexing
* docs: update pypgstac documentation to include index_fields option for customizable indexing
Copy file name to clipboardExpand all lines: docs/src/pypgstac.md
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,80 @@ To upsert any records, adding anything new and replacing anything with the same
85
85
pypgstac load items --method upsert
86
86
```
87
87
88
+
### Loading Queryables
89
+
90
+
Queryables are a mechanism that allows clients to discover what terms are available for use when writing filter expressions in a STAC API. The Filter Extension enables clients to filter collections and items based on their properties using the Common Query Language (CQL2).
By default, no indexes are created when loading queryables. Using the `--index_fields` parameter allows you to selectively create indexes only for fields that require them. Creating too many indexes can degrade database performance, especially for write operations, so it's recommended to only index fields that are frequently used in queries.
117
+
118
+
When using `--delete_missing` with specific collections, only properties for those collections will be deleted:
The JSON file should follow the queryables schema as described in the [STAC API - Filter Extension](https://github.com/stac-api-extensions/filter#queryables). Here's an example:
"description": "Queryable names for the Example STAC API",
139
+
"properties": {
140
+
"id": {
141
+
"description": "Item identifier",
142
+
"type": "string"
143
+
},
144
+
"datetime": {
145
+
"description": "Datetime",
146
+
"type": "string",
147
+
"format": "date-time"
148
+
},
149
+
"eo:cloud_cover": {
150
+
"description": "Cloud cover percentage",
151
+
"type": "number",
152
+
"minimum": 0,
153
+
"maximum": 100
154
+
}
155
+
},
156
+
"additionalProperties": true
157
+
}
158
+
```
159
+
160
+
The command will extract the properties from the JSON file and create queryables in the database. It will also determine the appropriate property wrapper based on the type of each property and create the necessary indexes.
161
+
88
162
### Automated Collection Extent Updates
89
163
90
164
By setting `pgstac.update_collection_extent` to `true`, a trigger is enabled to automatically adjust the spatial and temporal extents in collections when new items are ingested. This feature, while helpful, may increase overhead within data load transactions. To alleviate performance impact, combining this setting with `pgstac.use_queue` is beneficial. This approach necessitates a separate process, such as a scheduled task via the `pg_cron` extension, to periodically invoke `CALL run_queued_queries();`. Such asynchronous processing ensures efficient transactional performance and updated collection extents.
0 commit comments