tilezilla.db package¶
Module contents¶
Database for tilezilla
This submodule assists with access to the database that indexes products
ingested by tilezilla. The chief way of accessing the database is via
the Database, DatacubeResource, and DatasetResource.
The “resources” are designed to be a higher level access to
the database. As such, DatacubeResource and DatasetResource
both return instances of the object type (a tile specification, a tile, a
product, a band) requested while Database will return a SqlAlchemy ORM
object instance retrieved from the database.
The DatacubeResource handles tile specifications and tiles while the
DatasetResource deals with products and bands.
TODO: * Searches
- Search using filter_by by combining keyword arguments for each database level (Tile, Product, Band) and dictionaries passed to these keyword arguments
- Tie this search into click CLI (multiple key=value flags)
- Database info request
- Get fields
- Tie field enumeration to click CLI
- Some kind of field -> click option generator?
- E.g.,
tilez db info tile --horizontal=<int>
- Summary statistics about a database tile, collection, etc.
-
class
tilezilla.db.Database(engine, session)[source]¶ Bases:
objectThe database connection
-
classmethod
connect(uri, connect_args=None, debug=False)[source]¶ Return a Database for a given URI
Parameters: Returns: Database
-
classmethod
-
class
tilezilla.db.DatacubeResource(db, tilespec, storage)[source]¶ Bases:
objectTiles of products for a given tile specification
Parameters:
-
class
tilezilla.db.DatasetResource(db, datacube)[source]¶ Bases:
objectIndividual dataset product observations
-
ensure_band(product_id, band)[source]¶ Add a band to index, creating if necessary
Parameters: Returns: Database ID for the band added or retrieved
Return type:
-
ensure_product(tile_id, product)[source]¶ Add a product to index, creating if needed
Returns: Database ID of the product added or retrieved Return type: int
-
get_product_bands(tile_id, product)[source]¶ Return list of Bands indexed from a product for a given tile
Parameters: - tile_id (int) – Check for products in this tile
- product (BaseProduct) – The product to check for
Returns: A list of :class:`Band`s indexed for this product and tile
Return type: list[Band]
-