|
| 1 | +sqlalchemy-libsql |
| 2 | +================= |
| 3 | + |
| 4 | +A `LibSQL<https://libsql.org/>`_ dialect for SQLAlchemy. |
| 5 | + |
| 6 | +This dialect requires SQLAlchemy 2.0 or later. |
| 7 | + |
| 8 | + |
| 9 | +Pre-requisites |
| 10 | +-------------- |
| 11 | + |
| 12 | +- Running instance of https://github.com/libsql/sqld. You can easily get one at https://turso.tech/ |
| 13 | +- Alternatively a https://github.com/libsql/hrana-test-server, a pure-python implementation |
| 14 | + |
| 15 | +Co-requisites |
| 16 | +------------- |
| 17 | + |
| 18 | +This dialect requires SQLAlchemy and libsql_client. They are specified as requirements so ``pip`` |
| 19 | +will install them if they are not already in place. To install, just:: |
| 20 | + |
| 21 | + pip install sqlalchemy-libsql |
| 22 | + |
| 23 | +Getting Started |
| 24 | +--------------- |
| 25 | + |
| 26 | +Create an URL that points to your libsql database. |
| 27 | +Then, in your Python app, you can connect to the database via:: |
| 28 | + |
| 29 | + from sqlalchemy import create_engine |
| 30 | + engine = create_engine("sqlite+libsql://your-db.your-server.com?authToken=JWT_HERE&secure=true") |
| 31 | + |
| 32 | +Note that ``secure=true`` query/search parameter will force the usage of |
| 33 | +secure WebSockets (``wss://``) to connect to the remote server. |
| 34 | + |
| 35 | + |
| 36 | +The SQLAlchemy Project |
| 37 | +====================== |
| 38 | + |
| 39 | +SQLAlchemy-libsql is part of the `SQLAlchemy Project <https://www.sqlalchemy.org>`_ and |
| 40 | +adheres to the same standards and conventions as the core project. |
| 41 | + |
| 42 | +Development / Bug reporting / Pull requests |
| 43 | +------------------------------------------- |
| 44 | + |
| 45 | +Please refer to the |
| 46 | +`SQLAlchemy Community Guide <https://www.sqlalchemy.org/develop.html>`_ for |
| 47 | +guidelines on coding and participating in this project. |
| 48 | + |
| 49 | +Code of Conduct |
| 50 | +_______________ |
| 51 | + |
| 52 | +Above all, SQLAlchemy places great emphasis on polite, thoughtful, and |
| 53 | +constructive communication between users and developers. |
| 54 | +Please see our current Code of Conduct at |
| 55 | +`Code of Conduct <https://www.sqlalchemy.org/codeofconduct.html>`_. |
| 56 | + |
| 57 | + |
| 58 | +Credits |
| 59 | +======= |
| 60 | + |
| 61 | +This project structure is based on |
| 62 | +https://github.com/gordthompson/sqlalchemy-access, a project cited at |
| 63 | +`README.dialects.rst |
| 64 | +<https://github.com/sqlalchemy/sqlalchemy/blob/main/README.dialects.rst>`_. |
| 65 | + |
| 66 | + |
| 67 | +License |
| 68 | +======= |
| 69 | + |
| 70 | +SQLAlchemy-libsql is distributed under the `MIT license |
| 71 | +<https://opensource.org/licenses/MIT>`_. |
0 commit comments