{ "cells": [ { "cell_type": "markdown", "id": "82d9ed3a-e587-4a3b-9de1-ac2a1f89feaf", "metadata": {}, "source": [ "# SQLAlchemy\n", "\n", "" ] }, { "cell_type": "markdown", "id": "dea73729-6ffb-4b06-9c4c-d24ed1a4310e", "metadata": {}, "source": [ "| **Capability** \t| **Support** \t|\n", "|:-----------:\t|:-----------:\t|\n", "| Persistence \t| ✓ \t|\n", "| Files \t| ✗ \t|\n", "| Simulation \t| ✗ \t|\n", "| Cache \t| ✗ \t|" ] }, { "cell_type": "markdown", "id": "326fdb5a-01e1-4c1b-adfe-cc369513bdef", "metadata": {}, "source": [ "The SQLAlchemy wrapper can store ontology individuals using several tables on any of the database backends suported by [SQLAlchemy](https://www.sqlalchemy.org/). It is based on the [rdflib-sqlalchemy](https://github.com/RDFLib/rdflib-sqlalchemy) package. The wrapper is included with SimPhoNy and available under `simphony_osp.wrappers.SQLAlchemy`." ] }, { "cell_type": "code", "execution_count": 1, "id": "1a77b8c1-1df7-4ea2-be35-99e895d9702f", "metadata": {}, "outputs": [], "source": [ "from simphony_osp.wrappers import SQLAlchemy" ] }, { "cell_type": "markdown", "id": "df69fe31-34e2-4d7b-ac42-d402bdeb0121", "metadata": {}, "source": [ "⠀" ] }, { "cell_type": "markdown", "id": "42f1a5ab-746f-46a0-b461-e5fd7670f4d5", "metadata": {}, "source": [ "**Configuration**" ] }, { "cell_type": "markdown", "id": "c62ac54c-ab0f-4335-ad7f-2f781bd9db8d", "metadata": {}, "source": [ "The [configuration string](introduction.ipynb) for the SQLAlchemy wrapper is an [SQLAlchemy Database URL](https://docs.sqlalchemy.org/en/14/core/engines.html#database-urls). To use the wrapper, just provide such an URL and the `create` argument." ] }, { "cell_type": "code", "execution_count": 2, "id": "ec2b9121-09e2-4804-9ec5-b7c3ac90d308", "metadata": {}, "outputs": [], "source": [ "sqlalchemy = SQLAlchemy('sqlite:///database.db', True)" ] }, { "cell_type": "markdown", "id": "3a88d725-3fd6-4ba0-ac15-6540b95a40ea", "metadata": {}, "source": [ "