Using SQL Databases

SQL Alchemy is a SQL framework for python. It has a core layer, and an ORM layer.

See:

The SQLStore class provides a convenient wrapper around these generators for working with SQL Data

SQLStore

class linkml.utils.sqlutils.SQLStore(schema: Optional[Union[str, linkml_runtime.linkml_model.meta.SchemaDefinition]] = None, schemaview: Optional[linkml_runtime.utils.schemaview.SchemaView] = None, engine: Optional[sqlalchemy.engine.base.Engine] = None, database_path: Optional[str] = None, module: Optional[module] = None, native_module: Optional[module] = None, include_schema_in_database: Optional[bool] = None, **kwargs)[source]

A wrapper for a SQLLite database

compile()[source]

Compile SQLAlchemy object model

db_exists(create=True, force=False)[source]
Parameters
  • create

  • force

Returns

dump(element: linkml_runtime.utils.yamlutils.YAMLRoot, append=True) None[source]

Store an element in the database

Parameters
  • element

  • append

Returns

from_sqla(obj: Any) Optional[Union[linkml_runtime.utils.yamlutils.YAMLRoot, List[linkml_runtime.utils.yamlutils.YAMLRoot]]][source]

Translate from SQLAlchemy declarative module to native LinkML

Parameters

obj

Returns

to_sqla(obj: Union[linkml_runtime.utils.yamlutils.YAMLRoot, list]) Any[source]

Translate native LinkML object to SQLAlchemy declarative module

Parameters

obj

Returns

Command Line