Metadata-Version: 2.4
Name: sqlalchemy-libsql
Version: 0.2.0
Summary: SQLAlchemy dialect for libSQL
Author-email: Levy Albuquerque <levy@turso.tech>
License: MIT
Project-URL: Homepage, https://github.com/tursodatabase/libsql-sqlalchemy
Project-URL: Documentation, https://github.com/tursodatabase/libsql-sqlalchemy#readme
Project-URL: Repository, https://github.com/tursodatabase/libsql-sqlalchemy.git
Project-URL: Issues, https://github.com/tursodatabase/libsql-sqlalchemy/issues
Keywords: sqlalchemy,libsql,database,dialect
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: libsql-experimental>=0.0.53
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: greenlet>=3.0.3
Provides-Extra: dev
Requires-Dist: pytest>=8.3.5; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.5; extra == "dev"
Dynamic: license-file

<p align="center">
  <a href="https://docs.turso.tech/sdk/python/quickstart">
    <img alt="Turso + SQLAlchemy" src="https://github.com/tursodatabase/libsql-experimental-python/assets/950181/3748f2b3-872e-4cdd-bbe3-78491fd81dfa" width="1000">
    <h3 align="center">Turso + SQLAlchemy (experimental)</h3>
  </a>
</p>

<i><b>This package is experimental, which means it is not consider to be production grade. Furthermore, the package currently only supports Linux and macOS.</b></i>

<p align="center">
  SQLite for Production. Powered by <a href="https://turso.tech/libsql">libSQL</a>.
</p>

<p align="center">
  <a href="https://turso.tech"><strong>Turso</strong></a> ·
  <a href="https://docs.turso.tech/quickstart"><strong>Quickstart</strong></a> ·
  <a href="/examples"><strong>Examples</strong></a> ·
  <a href="https://docs.turso.tech"><strong>Docs</strong></a> ·
  <a href="https://discord.gg/turso"><strong>Discord</strong></a> ·
  <a href="https://blog.turso.tech/"><strong>Blog &amp; Tutorials</strong></a>
</p>

<p align="center">
  <a href="https://pypi.org/project/sqlalchemy-libsql">
    <img src="https://badge.fury.io/py/sqlalchemy-libsql.svg" alt="PyPI" title="PyPI" />
  </a>
  <a href="https://discord.com/invite/4B5D7hYwub">
    <img src="https://dcbadge.vercel.app/api/server/4B5D7hYwub?style=flat" alt="discord activity" title="join us on discord" />
  </a>
</p>

---

## Examples

#### Embedded Replica

```python
import os
from sqlalchemy import create_engine

engine = create_engine(
     "sqlite+libsql:///embedded.db",
     connect_args={
         "auth_token": os.getenv("TURSO_AUTH_TOKEN"),
         "sync_url": f"{os.getenv("TURSO_DATABASE_URL")}",
     },
)
```

#### Remote Database

```python
import os
from sqlalchemy import create_engine

engine = create_engine(
    f"sqlite+libsql://{os.getenv("TURSO_DATABASE_URL")}?secure=true",
    connect_args={
        "auth_token": os.getenv("TURSO_AUTH_TOKEN"),
    },
)
```

#### In-Memory Database

```python
from sqlalchemy import create_engine

engine = create_engine("sqlite+libsql://")
```

#### Local Database

```python
from sqlalchemy import create_engine

engine = create_engine("sqlite+libsql:///local.db")
```

## Documentation

1. [Turso Quickstart](https://docs.turso.tech/quickstart) &mdash; Learn how create and connect your first database.
2. [SDK Quickstart](https://docs.turso.tech/sdk/python/quickstart) &mdash; Learn how to install and execute queries using the libSQL client.
3. [SDK Reference](https://docs.turso.tech/sdk/python/reference) &mdash; Dive deeper with the libSQL SDK reference and examples.

### What is Turso?

[Turso](https://turso.tech) is a SQLite-compatible database built on [libSQL](https://docs.turso.tech/libsql), the Open Contribution fork of SQLite. It enables scaling to hundreds of thousands of databases per organization and supports replication to any location, including your own servers, for microsecond-latency access.

Learn more about what you can do with Turso:

- [Embedded Replicas](https://docs.turso.tech/features/embedded-replicas)
- [Platform API](https://docs.turso.tech/features/platform-api)
- [Branching](https://docs.turso.tech/features/branching)
- [Point-in-Time Recovery](https://docs.turso.tech/features/point-in-time-recovery)

