Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit d751c0c

Browse files
committed
Initial commit
0 parents  commit d751c0c

14 files changed

Lines changed: 4974 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
if: github.event.pull_request.draft != true
13+
strategy:
14+
matrix:
15+
"python-version": ["3.7", "3.11"]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: "Install Poetry"
19+
run: "pip install poetry"
20+
- name: "Setup Python"
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "${{ matrix.python-version }}"
24+
cache: "poetry"
25+
- name: "Install poetry dependencies"
26+
run: "poetry install --no-interaction"
27+
- uses: pre-commit/action@v3.0.0
28+
- name: "Checkout hrana-test-server"
29+
uses: actions/checkout@v3
30+
with:
31+
repository: "libsql/hrana-test-server"
32+
path: "hrana-test-server"
33+
- name: "Test with server v2"
34+
run: "poetry run python hrana-test-server/server_v2.py pytest --verbose"

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.eggs/
2+
/.idea/
3+
/.venv/
4+
/build/
5+
/dist/
6+
/test/__pycache__/
7+
/sqlalchemy_libsql/__pycache__/
8+
/sqlalchemy_libsql.egg-info/

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/python/black
5+
rev: 22.8.0
6+
hooks:
7+
- id: black
8+
9+
- repo: https://github.com/sqlalchemyorg/zimports
10+
rev: v0.6.0
11+
hooks:
12+
- id: zimports
13+
14+
- repo: https://github.com/pycqa/flake8
15+
rev: 5.0.0
16+
hooks:
17+
- id: flake8
18+
additional_dependencies:
19+
- flake8-import-order
20+
- flake8-import-single==0.1.5
21+
- flake8-builtins
22+
- flake8-future-annotations>=0.0.5
23+
- flake8-docstrings>=1.6.0
24+
- flake8-rst-docstrings
25+
# flake8-rst-docstrings dependency, leaving it here
26+
# in case it requires a version pin
27+
- pydocstyle
28+
- pygments
29+
30+
31+
- repo: local
32+
hooks:
33+
- id: pytest-check
34+
name: pytest-check
35+
entry: pytest
36+
language: system
37+
pass_filenames: false
38+
always_run: true

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Douglas Montes <dmontes@chiselstrike.com>
2+
Gustavo Sverzut Barbieri <barbieri@profusion.mobi>

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2005-2023 SQLAlchemy authors and contributors <see AUTHORS file>.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

Comments
 (0)