Skip to content

Commit 9effb17

Browse files
authored
Make consistent: STAC, PgSTAC, pyPgSTAC (#244)
* Make caps consistent: PgSTAC, pyPgSTAC * Capitalization consistency: STAC
1 parent f54094e commit 9effb17

File tree

11 files changed

+42
-42
lines changed

11 files changed

+42
-42
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "PGStac",
2+
"name": "PgSTAC",
33
"dockerComposeFile": "../docker-compose.yml",
44
"service": "pgstac",
55
"workspaceFolder": "/opt/src"

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Development - Contributing
22

3-
PGStac uses a dockerized development environment. However,
3+
PgSTAC uses a dockerized development environment. However,
44
it still needs a local install of pypgstac to allow an editable
55
install inside the docker container. This is installed automatically
66
if you have set up a virtual environment for the project. Otherwise
@@ -58,7 +58,7 @@ This will create a base migration for the new version and will create incrementa
5858
All changes to SQL should only be made in the `/src/pgstac/sql` directory. SQL Files will be run in alphabetical order.
5959

6060
### Adding Tests
61-
PGStac tests can be written using PGTap or basic SQL output comparisons. Additional testing is available using PyTest in the PyPgSTAC module. Tests can be run using the `scripts/test` command.
61+
PgSTAC tests can be written using PGTap or basic SQL output comparisons. Additional testing is available using PyTest in the PyPgSTAC module. Tests can be run using the `scripts/test` command.
6262

6363
PGTap tests can be written using [PGTap](https://pgtap.org/) syntax. Tests should be added to the `/src/pgstac/tests/pgtap` directory. Any new sql files added to this directory must be added to `/src/pgstac/tests/pgtap.sql`.
6464

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
PgSTAC provides functionality for STAC Filters, CQL2 search, and utilities to help manage the indexing and partitioning of STAC Collections and Items.
3030

31-
PgSTAC is used in production to scale to hundreds of millions of STAC items. PgSTAC implements core data models and functions to provide a STAC API from a PostgreSQL database. PgSTAC is entirely within the database and does not provide an HTTP-facing API. The [Stac FastAPI](https://github.com/stac-utils/stac-fastapi) PgSTAC backend and [Franklin](https://github.com/azavea/franklin) can be used to expose a PgSTAC catalog. Integrating PgSTAC with any other language with PostgreSQL drivers is also possible.
31+
PgSTAC is used in production to scale to hundreds of millions of STAC items. PgSTAC implements core data models and functions to provide a STAC API from a PostgreSQL database. PgSTAC is entirely within the database and does not provide an HTTP-facing API. The [STAC FastAPI](https://github.com/stac-utils/stac-fastapi) PgSTAC backend and [Franklin](https://github.com/azavea/franklin) can be used to expose a PgSTAC catalog. Integrating PgSTAC with any other language with PostgreSQL drivers is also possible.
3232

3333
PgSTAC Documentation: https://stac-utils.github.io/pgstac/pgstac
3434

docs/src/pgstac.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
PGDatabase Schema and Functions for Storing and Accessing STAC collections and items in PostgreSQL
33

4-
STAC Client that uses PGStac available in [STAC-FastAPI](https://github.com/stac-utils/stac-fastapi)
4+
STAC Client that uses PgSTAC available in [STAC-FastAPI](https://github.com/stac-utils/stac-fastapi)
55

6-
PGStac requires **Postgresql>=13** and **PostGIS>=3**. Best performance will be had using PostGIS>=3.1.
6+
PgSTAC requires **Postgresql>=13** and **PostGIS>=3**. Best performance will be had using PostGIS>=3.1.
77

8-
### PGStac Settings
9-
PGStac installs everything into the pgstac schema in the database. This schema must be in the search_path in the postgresql session while using pgstac.
8+
### PgSTAC Settings
9+
PgSTAC installs everything into the pgstac schema in the database. This schema must be in the search_path in the postgresql session while using pgstac.
1010

1111

12-
#### PGStac Users
12+
#### PgSTAC Users
1313
The pgstac_admin role is the owner of all the objects within pgstac and should be used when running things such as migrations.
1414

1515
The pgstac_ingest role has read/write privileges on all tables and should be used for data ingest or if using the transactions extension with stac-fastapi-pgstac.
@@ -28,7 +28,7 @@ To grant pgstac permissions to a current postgresql user:
2828
GRANT pgstac_read TO <user>;
2929
```
3030

31-
#### PGStac Search Path
31+
#### PgSTAC Search Path
3232
The search_path can be set at the database level or role level or by setting within the current session. The search_path is already set if you are directly using one of the pgstac users. If you are not logging in directly as one of the pgstac users, you will need to set the search_path by adding it to the search_path of the user you are using:
3333
```sql
3434
ALTER ROLE <user> SET SEARCH_PATH TO pgstac, public;
@@ -45,13 +45,13 @@ kwargs={
4545
}
4646
```
4747

48-
#### PGStac Settings Variables
48+
#### PgSTAC Settings Variables
4949
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).
5050
The context is "off" by default, and the default filter language is set to "cql2-json".
5151

5252
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.
5353

54-
Turning "context" on can be **very** expensive on larger databases. Much of what PGStac does is to optimize the search of items sorted by time where only fewer than 10,000 records are returned at a time. It does this by searching for the data in chunks and is able to "short circuit" and return as soon as it has the number of records requested. Calculating the context (the total count for a query) requires a scan of all records that match the query parameters and can take a very long time. Setting "context" to auto will use database statistics to estimate the number of rows much more quickly, but for some queries, the estimate may be quite a bit off.
54+
Turning "context" on can be **very** expensive on larger databases. Much of what PgSTAC does is to optimize the search of items sorted by time where only fewer than 10,000 records are returned at a time. It does this by searching for the data in chunks and is able to "short circuit" and return as soon as it has the number of records requested. Calculating the context (the total count for a query) requires a scan of all records that match the query parameters and can take a very long time. Setting "context" to auto will use database statistics to estimate the number of rows much more quickly, but for some queries, the estimate may be quite a bit off.
5555

5656
Example for updating the pgstac_settings table with a new value:
5757
```sql
@@ -92,19 +92,19 @@ The nohydrate conf item returns an unhydrated item bypassing the CPU intensive s
9292
SELECT search('{"conf":{"nohydrate"=true}}');
9393
```
9494
95-
#### PGStac Partitioning
96-
By default PGStac partitions data by collection (note: this is a change starting with version 0.5.0). Each collection can further be partitioned by either year or month. **Partitioning must be set up prior to loading any data!** Partitioning can be configured by setting the partition_trunc flag on a collection in the database.
95+
#### PgSTAC Partitioning
96+
By default PgSTAC partitions data by collection (note: this is a change starting with version 0.5.0). Each collection can further be partitioned by either year or month. **Partitioning must be set up prior to loading any data!** Partitioning can be configured by setting the partition_trunc flag on a collection in the database.
9797
```sql
9898
UPDATE collections set partition_trunc='month' WHERE id='<collection id>';
9999
```
100100
101101
In general, you should aim to keep each partition less than a few hundred thousand rows. Further partitioning (ie setting everything to 'month' when not needed to keep the partitions below a few hundred thousand rows) can be detrimental.
102102
103-
#### PGStac Indexes / Queryables
103+
#### PgSTAC Indexes / Queryables
104104
105-
By default, PGStac includes indexes on the id, datetime, collection, and geometry. Further indexing can be added for additional properties globally or only on particular collections by modifications to the queryables table.
105+
By default, PgSTAC includes indexes on the id, datetime, collection, and geometry. Further indexing can be added for additional properties globally or only on particular collections by modifications to the queryables table.
106106
107-
The `queryables` table controls the indexes that PGStac will build as well as the metadata that is returned from a [STAC Queryables endpoint](https://github.com/stac-api-extensions/filter#queryables).
107+
The `queryables` table controls the indexes that PgSTAC will build as well as the metadata that is returned from a [STAC Queryables endpoint](https://github.com/stac-api-extensions/filter#queryables).
108108
109109
| Column | Description | Type | Example |
110110
|-----------------------|--------------------------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------------------------|

docs/src/pypgstac.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
PgSTAC includes a Python utility for bulk data loading and managing migrations.
44

5-
PyPGStac is available on PyPI
5+
pyPgSTAC is available on PyPI
66
```
77
pip install pypgstac
88
```
99

10-
By default, PyPGStac does not install the `psycopg` dependency. If you want the database driver installed, use:
10+
By default, pyPgSTAC does not install the `psycopg` dependency. If you want the database driver installed, use:
1111

1212
```
1313
pip install pypgstac[psycopg]
@@ -39,7 +39,7 @@ Commands:
3939
version Get version from a pgstac database.
4040
```
4141

42-
PyPGStac will get the database connection settings from the **standard PG environment variables**:
42+
pyPgSTAC will get the database connection settings from the **standard PG environment variables**:
4343

4444
- PGHOST=0.0.0.0
4545
- PGPORT=5432
@@ -50,18 +50,18 @@ PyPGStac will get the database connection settings from the **standard PG enviro
5050
It can also take a DSN database url "postgresql://..." via the **--dsn** flag.
5151

5252
### Migrations
53-
PyPGStac has a utility to help apply migrations to an existing PGStac instance to bring it up to date.
53+
pyPgSTAC has a utility to help apply migrations to an existing PgSTAC instance to bring it up to date.
5454

5555
There are two types of migrations:
56-
- **Base migrations** install PGStac into a database with no current PGStac installation. These migrations follow the file pattern `"pgstac.[version].sql"`
57-
- **Incremental migrations** are used to move PGStac from one version to the next. These migrations follow the file pattern `"pgstac.[version].[fromversion].sql"`
56+
- **Base migrations** install PgSTAC into a database with no current PgSTAC installation. These migrations follow the file pattern `"pgstac.[version].sql"`
57+
- **Incremental migrations** are used to move PgSTAC from one version to the next. These migrations follow the file pattern `"pgstac.[version].[fromversion].sql"`
5858

59-
Migrations are stored in ```pypgstac/pypgstac/migration`s``` and are distributed with the PyPGStac package.
59+
Migrations are stored in ```pypgstac/pypgstac/migration`s``` and are distributed with the pyPgSTAC package.
6060

6161
### Running Migrations
62-
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.
62+
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.
6363

64-
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:
64+
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:
6565
```
6666
pypgstac migrate
6767
```

src/pypgstac/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# pypgstac
22

3-
Python tools for working with PGStac
3+
Python tools for working with PgSTAC
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""PyPGStac Version."""
1+
"""pyPgSTAC Version."""
22
from pypgstac.version import __version__
33

44
__all__ = ["__version__"]

src/pypgstac/python/pypgstac/db.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Base library for database interaction with PgStac."""
1+
"""Base library for database interaction with PgSTAC."""
22
import atexit
33
import logging
44
import time
@@ -53,7 +53,7 @@ class Settings(BaseSettings):
5353

5454

5555
class PgstacDB:
56-
"""Base class for interacting with PgStac Database."""
56+
"""Base class for interacting with PgSTAC Database."""
5757

5858
def __init__(
5959
self,
@@ -260,7 +260,7 @@ def version(self) -> Optional[str]:
260260
if isinstance(version, str):
261261
return version
262262
except psycopg.errors.UndefinedTable:
263-
logger.debug("PGStac is not installed.")
263+
logger.debug("PgSTAC is not installed.")
264264
if self.connection is not None:
265265
self.connection.rollback()
266266
return None
@@ -278,7 +278,7 @@ def pg_version(self) -> str:
278278
version = version.decode()
279279
if isinstance(version, str):
280280
if int(version.split(".")[0]) < 13:
281-
raise Exception("PGStac requires PostgreSQL 13+")
281+
raise Exception("PgSTAC requires PostgreSQL 13+")
282282
return version
283283
else:
284284
if self.connection is not None:
@@ -299,5 +299,5 @@ def func(self, function_name: str, *args: Any) -> Generator:
299299
return self.query(base_query, cleaned_args)
300300

301301
def search(self, query: Union[dict, str, psycopg.types.json.Jsonb] = "{}") -> str:
302-
"""Search PgStac."""
302+
"""Search PgSTAC."""
303303
return dumps(next(self.func("search", query))[0])

src/pypgstac/python/pypgstac/migrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def run_migration(self, toversion: Optional[str] = None) -> str:
123123
toversion = "unreleased"
124124

125125
pg_version = self.db.pg_version
126-
logger.info(f"Migrating PGStac on PostgreSQL Version {pg_version}")
126+
logger.info(f"Migrating PgSTAC on PostgreSQL Version {pg_version}")
127127
oldversion = self.db.version
128128
if oldversion == toversion:
129129
logger.info(f"Target database already at version: {toversion}")

src/pypgstac/python/pypgstac/pypgstac.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class PgstacCLI:
16-
"""CLI for PgStac."""
16+
"""CLI for PgSTAC."""
1717

1818
def __init__(
1919
self,
@@ -22,7 +22,7 @@ def __init__(
2222
debug: bool = False,
2323
usequeue: bool = False,
2424
):
25-
"""Initialize PgStac CLI."""
25+
"""Initialize PgSTAC CLI."""
2626
if version:
2727
sys.exit(0)
2828

@@ -39,7 +39,7 @@ def initversion(self) -> str:
3939

4040
@property
4141
def version(self) -> Optional[str]:
42-
"""Get PGStac version installed on database."""
42+
"""Get PgSTAC version installed on database."""
4343
return self._db.version
4444

4545
@property
@@ -52,11 +52,11 @@ def pgready(self) -> None:
5252
self._db.wait()
5353

5454
def search(self, query: str) -> str:
55-
"""Search PgStac."""
55+
"""Search PgSTAC."""
5656
return self._db.search(query)
5757

5858
def migrate(self, toversion: Optional[str] = None) -> str:
59-
"""Migrate PgStac Database."""
59+
"""Migrate PgSTAC Database."""
6060
migrator = Migrate(self._db)
6161
return migrator.run_migration(toversion=toversion)
6262

@@ -68,7 +68,7 @@ def load(
6868
dehydrated: Optional[bool] = False,
6969
chunksize: Optional[int] = 10000,
7070
) -> None:
71-
"""Load collections or items into PGStac."""
71+
"""Load collections or items into PgSTAC."""
7272
loader = Loader(db=self._db)
7373
if table == "collections":
7474
loader.load_collections(file, method)

src/pypgstac/tests/hydration/test_hydrate_pg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test Hydration in PGStac."""
1+
"""Test Hydration in PgSTAC."""
22
import os
33
from contextlib import contextmanager
44
from typing import Any, Dict, Generator
@@ -12,7 +12,7 @@
1212

1313

1414
class TestHydratePG(THydrate):
15-
"""Test hydration using PGStac."""
15+
"""Test hydration using PgSTAC."""
1616

1717
@contextmanager
1818
def db(self) -> Generator[PgstacDB, None, None]:

0 commit comments

Comments
 (0)