Comments (1)
@bitner After some discussion with @edkeeble I've traced this issue to loading duplicate items with different datetime
. You can replicate this issue by modifying https://github.com/stac-utils/pgstac/blob/main/test/testdata/items.ndjson to include
{"id": "pgstac-test-item-0003", "bbox": [-85.379245, 30.933949, -85.308201, 31.003555], "type": "Feature", "links": [], "assets": {"image": {"href": "https://naipeuwest.blob.core.windows.net/naip/v002/al/2011/al_100cm_2011/30085/m_3008506_nw_16_1_20110825.tif", "type": "image/tiff; application=geotiff; profile=cloud-optimized", "roles": ["data"], "title": "RGBIR COG tile", "eo:bands": [{"name": "Red", "common_name": "red"}, {"name": "Green", "common_name": "green"}, {"name": "Blue", "common_name": "blue"}, {"name": "NIR", "common_name": "nir", "description": "near-infrared"}]}, "metadata": {"href": "https://naipeuwest.blob.core.windows.net/naip/v002/al/2011/al_fgdc_2011/30085/m_3008506_nw_16_1_20110825.txt", "type": "text/plain", "roles": ["metadata"], "title": "FGDC Metdata"}, "thumbnail": {"href": "https://naipeuwest.blob.core.windows.net/naip/v002/al/2011/al_100cm_2011/30085/m_3008506_nw_16_1_20110825.200.jpg", "type": "image/jpeg", "roles": ["thumbnail"], "title": "Thumbnail"}}, "geometry": {"type": "Polygon", "coordinates": [[[-85.309412, 30.933949], [-85.308201, 31.002658], [-85.378084, 31.003555], [-85.379245, 30.934843], [-85.309412, 30.933949]]]}, "collection": "pgstac-test-collection", "properties": {"gsd": 1, "datetime": "2011-08-25T01:00:00Z", "naip:year": "2011", "proj:bbox": [654842, 3423507, 661516, 3431125], "proj:epsg": 26916, "providers": [{"url": "https://www.fsa.usda.gov/programs-and-services/aerial-photography/imagery-programs/naip-imagery/", "name": "USDA Farm Service Agency", "roles": ["producer", "licensor"]}], "naip:state": "al", "proj:shape": [7618, 6674], "eo:cloud_cover": 28, "proj:transform": [1, 0, 654842, 0, -1, 3431125, 0, 0, 1]}, "stac_version": "1.0.0-beta.2", "stac_extensions": ["eo", "projection"]}
Which is identical to the first item in the file but with it's datetime
value incremented by 1 second. Now when running the pypgstac
tests you'll receive
Traceback (most recent call last):
File "/opt/src/pypgstac/tests/test_load.py", line 26, in test_load_testdata_succeeds
asyncio.run(
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/opt/src/pypgstac/pypgstac/load.py", line 246, in load_ndjson
await load_iterator(f, table, conn, method)
File "/opt/src/pypgstac/pypgstac/load.py", line 234, in load_iterator
await copy_upsert(iter, table, conn)
File "/opt/src/pypgstac/pypgstac/load.py", line 212, in copy_upsert
await conn.copy_to_table(
File "/usr/local/lib/python3.8/site-packages/asyncpg/connection.py", line 859, in copy_to_table
return await self._copy_in(copy_stmt, source, timeout)
File "/usr/local/lib/python3.8/site-packages/asyncpg/connection.py", line 1041, in _copy_in
return await self._protocol.copy_in(
File "asyncpg/protocol/protocol.pyx", line 506, in copy_in
asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "items_p2011w34_id_pk"
DETAIL: Key (id)=(pgstac-test-item-0003) already exists.
from pgstac.
Related Issues (20)
- Deadlock issue arises during STAC items ingestion HOT 4
- Setting up time partitioning after initial data load HOT 1
- Exception with a legitimate SQL query
- Optimizing query performance during ingestion process HOT 3
- Intermittent data ingestion issue HOT 5
- Don't allow Collections without ids to be written
- Removing queryables indices HOT 2
- PgStac no longer works with Azure Flexible Postgres server HOT 3
- How to create a STAC from a Postgres table based on the provided samples (s3 storing SAFE and pg dump) HOT 1
- scripts/install missing? HOT 1
- Occasional syntax errors from well formed search queries HOT 10
- CQL2: ILIKE vs. CASEI
- Validation Error and Content Mismatch in Sentinel-2-L1C Item Definition JSON HOT 3
- Error when installing pgstac > v0.8.1 HOT 2
- Changelog inaccurately indicates pypgstac loader compatibility within major version HOT 2
- Excessive growth of database logs HOT 1
- Unable to ingest private metadata HOT 8
- Feature request: Update collection extend from item(s) HOT 2
- BETWEEN operator bug
- CQL2 filters resulting in full scans despite indexed properties HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgstac.