Skip to content

Commit d8059a1

Browse files
authored
Added details for updating pgstac settings to readme (#79)
* added additional instructions for updating pgstac settings * added additional instructions for updating pgstac settings Co-authored-by: zoestatman-weil <Codingisfun18>
1 parent 78d3ecd commit d8059a1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,25 @@ PGStac requires **Postgresql>=12** and **PostGIS>=3**. Best performance will be
2525
### PGStac Settings
2626
PGStac installs everything into the pgstac schema in the database. You will need to make sure that this schema is set up in the search_path for the database.
2727

28-
There are additional variables that control the settings used for calculating and displaying context (total row count) for a search.
28+
There are additional variables that control the settings used for calculating and displaying context (total row count) for a search, as well as a variable to set the filter language (cql-json or cql-json2).
29+
The context is "off" by default, and the default filter language is set to "cql2-json".
2930

30-
Variables can be set either by passing them in via the connection options using your connection library or by setting them on the Role that is used to log in to the database.
31+
Variables can be set either by passing them in via the connection options using your connection library, setting them in the pgstac_settings table or by setting them on the Role that is used to log in to the database.
3132

33+
Example for updating the pgstac_settings table with a new value:
34+
```sql
35+
INSERT INTO pgstac_settings (name, value)
36+
VALUES
37+
('default-filter-lang', 'cql-json'),
38+
('context', 'on')
39+
40+
ON CONFLICT ON CONSTRAINT pgstac_settings_pkey DO UPDATE SET value = excluded.value;
41+
```
42+
43+
Alternatively, update the role:
3244
```
3345
ALTER ROLE <username> SET SEARCH_PATH to pgstac, public;
34-
ALTER ROLE <username> SET pgstac.collection TO <'on','off','auto'>;
46+
ALTER ROLE <username> SET pgstac.context TO <'on','off','auto'>;
3547
ALTER ROLE <username> SET pgstac.context_estimated_count TO '<number of estimated rows when in auto mode that when an estimated count is less than will trigger a full count>';
3648
ALTER ROLE <username> SET pgstac.context_estimated_cost TO '<estimated query cost from explain when in auto mode that when an estimated cost is less than will trigger a full count>';
3749
ALTER ROLE <username> SET pgstac.context_stats_ttl TO '<an interval string ie "1 day" after which pgstac search will force recalculation of it's estimates>>';
@@ -93,7 +105,7 @@ Migrations are stored in ```pypgstac/pypgstac/migration`s``` and are distributed
93105
### Running Migrations
94106
PyPGStac has a utility for checking the version of an existing PGStac database and applying the appropriate migrations in the correct order. It can also be used to setup a database from scratch.
95107

96-
To create an initial PGStac database or bring an existing one up to date:
108+
To create an initial PGStac database or bring an existing one up to date, check you have the pypgstac version installed you want to migrate to and run:
97109
```
98110
pypgstac migrate
99111
```

0 commit comments

Comments
 (0)