-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make item geometry and bbox nullable for sqlalchemy backend (#398)
Closes #350
- Loading branch information
Showing
7 changed files
with
247 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
..._fastapi/sqlalchemy/alembic/versions/7016c1bf3fbf_make_item_geometry_and_bbox_nullable.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Make item geometry and bbox nullable | ||
Revision ID: 7016c1bf3fbf | ||
Revises: 5909bd10f2e6 | ||
Create Date: 2022-04-28 10:40:06.856826 | ||
""" | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "7016c1bf3fbf" | ||
down_revision = "5909bd10f2e6" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.alter_column( | ||
schema="data", | ||
table_name="items", | ||
column_name="geometry", | ||
nullable=True, | ||
) | ||
op.alter_column( | ||
schema="data", | ||
table_name="items", | ||
column_name="bbox", | ||
nullable=True, | ||
) | ||
|
||
|
||
def downgrade(): | ||
# Downgrading will require the user to update or remove all null geometry | ||
# cases from the DB, otherwise the downgrade migration will fail. | ||
op.alter_column( | ||
schema="data", | ||
table_name="items", | ||
column_name="geometry", | ||
nullable=False, | ||
) | ||
op.alter_column( | ||
schema="data", | ||
table_name="items", | ||
column_name="bbox", | ||
nullable=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
stac_fastapi/sqlalchemy/tests/data/test_item_geometry_null.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
{ | ||
"type": "Feature", | ||
"stac_version": "1.0.0", | ||
"stac_extensions": [ | ||
"https://landsat.usgs.gov/stac/landsat-ard-extension/v1.0.0/schema.json", | ||
"https://stac-extensions.github.io/projection/v1.0.0/schema.json", | ||
"https://stac-extensions.github.io/eo/v1.0.0/schema.json", | ||
"https://stac-extensions.github.io/alternate-assets/v1.1.0/schema.json", | ||
"https://stac-extensions.github.io/storage/v1.0.0/schema.json" | ||
], | ||
"id": "LE07_CU_002012_20150101_20210502_02_BA", | ||
"description": "Landsat Collection 2 Level-3 Burned Area Product", | ||
"geometry": null, | ||
"properties": { | ||
"datetime": "2015-01-01T18:39:12.4885358Z", | ||
"platform": "LANDSAT_7", | ||
"instruments": [ | ||
"ETM" | ||
], | ||
"landsat:grid_horizontal": "02", | ||
"landsat:grid_vertical": "12", | ||
"landsat:grid_region": "CU", | ||
"landsat:scene_count": 1, | ||
"eo:cloud_cover": 0.0759, | ||
"landsat:cloud_shadow_cover": 0.1394, | ||
"landsat:snow_ice_cover": 0, | ||
"landsat:fill": 95.4286, | ||
"proj:epsg": null, | ||
"proj:shape": [ | ||
5000, | ||
5000 | ||
], | ||
"proj:transform": [ | ||
30, | ||
0, | ||
-2265585, | ||
0, | ||
-30, | ||
1514805 | ||
], | ||
"created": "2022-02-08T20:07:38.885Z", | ||
"updated": "2022-02-08T20:07:38.885Z" | ||
}, | ||
"assets": { | ||
"index": { | ||
"title": "HTML index page", | ||
"type": "text/html", | ||
"roles": [ | ||
"metadata" | ||
], | ||
"href": "https://landsatlook.usgs.gov/stac-browser/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02" | ||
}, | ||
"bp": { | ||
"title": "Burn Probability", | ||
"description": "Collection 2 Level-3 Albers Burn Probability Burned Area", | ||
"type": "image/vnd.stac.geotiff; cloud-optimized=true", | ||
"roles": [ | ||
"data" | ||
], | ||
"href": "https://landsatlook.usgs.gov/level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_BP.TIF", | ||
"alternate": { | ||
"s3": { | ||
"storage:platform": "AWS", | ||
"storage:requester_pays": true, | ||
"href": "s3://usgs-landsat-level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_BP.TIF" | ||
} | ||
} | ||
}, | ||
"bc": { | ||
"title": "Burn Classification", | ||
"description": "Collection 2 Level-3 Albers Burn Classification Burned Area", | ||
"type": "image/vnd.stac.geotiff; cloud-optimized=true", | ||
"roles": [ | ||
"data" | ||
], | ||
"href": "https://landsatlook.usgs.gov/level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_BC.TIF", | ||
"alternate": { | ||
"s3": { | ||
"storage:platform": "AWS", | ||
"storage:requester_pays": true, | ||
"href": "s3://usgs-landsat-level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_BC.TIF" | ||
} | ||
} | ||
}, | ||
"quick_look": { | ||
"title": "Quick Look File", | ||
"description": "Collection 2 Level-3 Albers Quick Look File Burned Area", | ||
"type": "image/png", | ||
"roles": [ | ||
"data" | ||
], | ||
"href": "https://landsatlook.usgs.gov/level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_QuickLook.png", | ||
"alternate": { | ||
"s3": { | ||
"storage:platform": "AWS", | ||
"storage:requester_pays": true, | ||
"href": "s3://usgs-landsat-level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02_QuickLook.png" | ||
} | ||
} | ||
}, | ||
"xml": { | ||
"title": "Extensible Metadata File", | ||
"description": "Collection 2 Level-3 Albers Extensible Metadata File Burned Area", | ||
"type": "application/xml", | ||
"roles": [ | ||
"metadata" | ||
], | ||
"href": "https://landsatlook.usgs.gov/level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02.xml", | ||
"alternate": { | ||
"s3": { | ||
"storage:platform": "AWS", | ||
"storage:requester_pays": true, | ||
"href": "s3://usgs-landsat-level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02.xml" | ||
} | ||
} | ||
}, | ||
"json": { | ||
"title": "Extensible Metadata File (json)", | ||
"description": "Collection 2 Level-3 Albers Extensible Metadata File (json) Burned Area", | ||
"type": "application/json", | ||
"roles": [ | ||
"metadata" | ||
], | ||
"href": "https://landsatlook.usgs.gov/level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02.json", | ||
"alternate": { | ||
"s3": { | ||
"storage:platform": "AWS", | ||
"storage:requester_pays": true, | ||
"href": "s3://usgs-landsat-level-3/collection02/BA/2015/CU/002/012/LE07_CU_002012_20150101_20210502_02_BA/LE07_CU_002012_20150101_20210502_02.json" | ||
} | ||
} | ||
} | ||
}, | ||
"links": [ | ||
{ | ||
"rel": "self", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2l3-ba/items/LE07_CU_002012_20150101_20210502_02_BA" | ||
}, | ||
{ | ||
"rel": "derived_from", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2ard-sr/items/LE07_CU_002012_20150101_20210502_02_SR" | ||
}, | ||
{ | ||
"rel": "derived_from", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2ard-st/items/LE07_CU_002012_20150101_20210502_02_ST" | ||
}, | ||
{ | ||
"rel": "derived_from", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2ard-ta/items/LE07_CU_002012_20150101_20210502_02_TOA" | ||
}, | ||
{ | ||
"rel": "derived_from", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2ard-bt/items/LE07_CU_002012_20150101_20210502_02_BT" | ||
}, | ||
{ | ||
"rel": "parent", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2l3-ba" | ||
}, | ||
{ | ||
"rel": "collection", | ||
"href": "https://landsatlook.usgs.gov/stac-server/collections/landsat-c2l3-ba" | ||
}, | ||
{ | ||
"rel": "root", | ||
"href": "https://landsatlook.usgs.gov/stac-server/" | ||
} | ||
], | ||
"collection": "test-collection" | ||
} |