{ "cells": [ { "cell_type": "markdown", "id": "9cf4e7aa-0b22-408a-a7d4-83b851eac5fa", "metadata": {}, "source": [ "# SQLite\n", "\n", "
\n", "\n", "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/simphony/docs/v4.0.0?filepath=docs%2Fusage%2Fwrappers%2Fsqlite.ipynb \"Click to run this tutorial yourself!\")\n", " \n", "
" ] }, { "cell_type": "markdown", "id": "d014a1f8-e537-4afe-8084-7a4dd0ff9e00", "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": "bc186ceb-7aa2-449f-8e9a-2ed642fb7d8f", "metadata": {}, "source": [ "The SQLite wrapper can store ontology individuals using several tables in an SQLite database file. It is actually just a special case of the more feature-rich [SQLAlchemy wrapper](sqlalchemy.ipynb). The SQLite wrapper is included with SimPhoNy and available under `simphony_osp.wrappers.SQLite`." ] }, { "cell_type": "code", "execution_count": 1, "id": "69c4415c-db20-48d6-ad4e-b5d9c22a47bc", "metadata": {}, "outputs": [], "source": [ "from simphony_osp.wrappers import SQLite" ] }, { "cell_type": "markdown", "id": "a3bfb046-5ed1-4233-ae73-d34c761309c5", "metadata": {}, "source": [ "⠀" ] }, { "cell_type": "markdown", "id": "df7e30b1-27a6-41e9-bff7-4a816cf6166e", "metadata": {}, "source": [ "**Configuration**" ] }, { "cell_type": "markdown", "id": "ae96af5e-6646-44cb-b942-02b3b8d15fa2", "metadata": {}, "source": [ "The [configuration string](introduction.ipynb) for the SQLite wrapper is the path to the database file to be used. To use the wrapper, just call it providing the [two arguments that SimPhoNy wrappers require](introduction.ipynb): the configuration string and the `create` argument." ] }, { "cell_type": "code", "execution_count": 2, "id": "7d2406f2-741a-4ab7-84e2-add188732537", "metadata": {}, "outputs": [], "source": [ "sqlite = SQLite('database.db', True)" ] }, { "cell_type": "markdown", "id": "279c98e7-71d7-4449-a1b7-d0869a2e6c4c", "metadata": {}, "source": [ "
\n", "
Tip
\n", " \n", "Keep in mind that the SQLite wrapper really just calls the [SQLAlchemy wrapper](sqlalchemy.ipynb) adding the suffix `sqlite:///` to the given configuration string.\n", " \n", "
" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }