linkml_store.api.stores.hdf5.hdf5_database module
- class HDF5Database(handle=None, **kwargs)[source]
Bases:
Database
- collection_class
alias of
HDF5Collection
- property file: File
- query(query, **kwargs)[source]
Run a query against the database.
Examples
>>> from linkml_store.api.client import Client >>> from linkml_store.api.queries import Query >>> client = Client() >>> db = client.attach_database("duckdb", alias="test") >>> collection = db.create_collection("Person") >>> collection.insert([{"id": "P1", "name": "John"}, {"id": "P2", "name": "Alice"}]) >>> query = Query(from_table="Person", where_clause={"name": "John"}) >>> result = db.query(query) >>> len(result.rows) 1 >>> result.rows[0]["id"] 'P1'
- type query:
Query
- param query:
- type kwargs:
- param kwargs:
- rtype:
QueryResult
- return:
- init_collections()[source]
Initialize collections.
TODO: Not typically called directly: consider making this private :return:
- induce_schema_view()[source]
Induce a schema view from a schema definition.
>>> from linkml_store.api.client import Client >>> from linkml_store.api.queries import Query >>> client = Client() >>> db = client.attach_database("duckdb", alias="test") >>> collection = db.create_collection("Person") >>> collection.insert([{"id": "P1", "name": "John", "age_in_years": 25}, ... {"id": "P2", "name": "Alice", "age_in_years": 25}]) >>> schema_view = db.induce_schema_view() >>> cd = schema_view.get_class("Person") >>> cd.attributes["id"].range 'string' >>> cd.attributes["age_in_years"].range 'integer'
- Return type:
SchemaView
- Returns:
A schema view