Skip to content

Commit

Permalink
Working v0.4.5 (#91)
Browse files Browse the repository at this point in the history
* fixes for v0.4.5
  • Loading branch information
bitner authored Feb 14, 2022
1 parent 3c2af06 commit 3499daa
Show file tree
Hide file tree
Showing 14 changed files with 2,920 additions and 49 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Changelog
## [v0.4.5]

### Fixed
- Fixes support for using the intersects parameter at the base of a search (regression from changes in 0.4.4)
- Fixes issue where results for a search on id returned [None] rather than [] (regression from changes in 0.4.4)


### Changed
- Changes requirement for PostgreSQL to 13+, the triggers used to main partitions are not available to be used on partitions prior to 13 ([#90](https://github.com/stac-utils/pgstac/pull/90))
- Bump requirement for asyncpg to 0.25.0 ([#82](https://github.com/stac-utils/pgstac/pull/82))

### Added
- Added more tests.

## [v0.4.4]

### Added
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ PGDatabase Schema and Functions for Storing and Accessing STAC collections and i

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

PGStac requires **Postgresql>=12** and **PostGIS>=3**. Best performance will be had using PostgreSQL>=13 and PostGIS>=3.1.
PGStac requires **Postgresql>=13** and **PostGIS>=3**. Best performance will be had using PostGIS>=3.1.

### PGStac Settings
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.

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).
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).
The context is "off" by default, and the default filter language is set to "cql2-json".

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.

Example for updating the pgstac_settings table with a new value:
```sql
INSERT INTO pgstac_settings (name, value)
VALUES
INSERT INTO pgstac_settings (name, value)
VALUES
('default-filter-lang', 'cql-json'),
('context', 'on')

ON CONFLICT ON CONSTRAINT pgstac_settings_pkey DO UPDATE SET value = excluded.value;
```

Expand Down
67 changes: 32 additions & 35 deletions pypgstac/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pypgstac/pypgstac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""PyPGStac Version."""
__version__ = "0.4.4"
__version__ = "0.4.5"
15 changes: 15 additions & 0 deletions pypgstac/pypgstac/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ async def get_version(conn: asyncpg.Connection) -> str:
return version


async def check_pg_version(conn: asyncpg.Connection) -> str:
"""Get the current pg version number from a pgstac database."""
async with conn.transaction():
version = await conn.fetchval(
"""
SHOW server_version;
"""
)
if int(version.split(".")[0]) < 13:
raise Exception("PGStac requires PostgreSQL 13+")
return version


async def get_version_dsn(dsn: Optional[str] = None) -> str:
"""Get current version from a specified database."""
conn = await asyncpg.connect(dsn=dsn)
Expand All @@ -138,6 +151,8 @@ async def run_migration(
files = []

conn = await asyncpg.connect(dsn=dsn)
pgversion = await check_pg_version(conn)
typer.echo(f"Migrating PGStac on PostgreSQL Version {pgversion}")
oldversion = await get_version(conn)
try:
if oldversion == toversion:
Expand Down
Loading

0 comments on commit 3499daa

Please sign in to comment.