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

Commit ce412ae

Browse files
committed
sqlx->sqls; README.md; tests.yaml;
1 parent 949e6b8 commit ce412ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+152
-129
lines changed

Diff for: .github/workflows/tests.yaml

+20-19
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ on:
77
jobs:
88
tests:
99
runs-on: ${{ matrix.os }}
10+
1011
strategy:
1112
matrix:
1213
os: [ ubuntu-latest ]
1314
python-version: [ '3.10', '3.11', '3.12' ]
14-
#
15-
# services:
16-
# redis:
17-
# image: mysql:latest
18-
# ports:
19-
# - 3306:3306
20-
#
21-
# steps:
22-
# - uses: actions/checkout@v2
23-
# - name: Set up Python ${{ matrix.python-version }}
24-
# uses: actions/setup-python@v2
25-
# with:
26-
# python-version: ${{ matrix.python-version }}
27-
# - name: Install dependencies
28-
# run: |
29-
# python -m pip install --upgrade pip
30-
# pip install tox tox-gh-actions
31-
# - name: Test with tox
32-
# run: tox
15+
16+
services:
17+
mysql:
18+
image: mysql:latest
19+
ports:
20+
- 3306:3306
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install tox tox-gh-actions
32+
- name: Test with tox
33+
run: tox

Diff for: README.md

+22

Diff for: examples/common.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pydantic import Field
2-
from sqlx import SQLX, Schema
2+
from sqls import SQLS, Schema
33
import asyncio
44

55

@@ -12,22 +12,22 @@ class User(Schema):
1212

1313

1414
async def main():
15-
sqlx = SQLX(
15+
sqls = SQLS(
1616
db='test',
1717
user='root',
1818
password='password',
1919
)
2020

21-
await sqlx.create_pool()
21+
await sqls.create_pool()
2222

23-
users = await sqlx.count().fr0m(User).where({
23+
users = await sqls.count().fr0m(User).where({
2424
User.model().username: 'username'
2525
}).order_by(
2626
User.model().username.desc()
2727
).limit(10).offset(5).all()
2828
print(users)
2929

30-
await sqlx.close_pool()
30+
await sqls.close_pool()
3131

3232

3333
if __name__ == '__main__':

Diff for: sqls/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .core.sqls import SQLS
2+
from .types import Schema
File renamed without changes.

Diff for: sqlx/core/result.py renamed to sqls/core/result.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import aiomysql
66

7-
from sqlx.types import Schema, Query, Args, Row
7+
from sqls.types import Schema, Query, Args, Row
88

99

1010
class Result:

Diff for: sqlx/core/sqlx.py renamed to sqls/core/sqls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import aiomysql
44

5-
from sqlx.sql.vendor import SQLVendor
5+
from sqls.sql.vendor import SQLVendor
66

77

8-
class SQLX(SQLVendor):
8+
class SQLS(SQLVendor):
99
pool: aiomysql.Pool
1010

1111
def __init__(self, *args, **kwargs):
File renamed without changes.
File renamed without changes.

Diff for: sqlx/sql/mixin/fr0m.py renamed to sqls/sql/mixin/fr0m.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Union, overload, Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Schema
77

88

@@ -41,7 +41,7 @@ def fr0m(
4141
elif table := getattr(table, '__table__', None):
4242
...
4343
else:
44-
raise NotImplementedError('No mathing @overload found for `sqlx.fr0m(...)`')
44+
raise NotImplementedError('No mathing @overload found for `sqls.fr0m(...)`')
4545

4646
self._query.update(f'FROM `{table}`')
4747

Diff for: sqlx/sql/mixin/into.py renamed to sqls/sql/mixin/into.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Union, overload, Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Schema
77

88

@@ -41,7 +41,7 @@ def into(
4141
elif table := getattr(table, '__table__', None):
4242
...
4343
else:
44-
raise NotImplementedError('No matching @overload found for `sqlx.into(...)`')
44+
raise NotImplementedError('No matching @overload found for `sqls.into(...)`')
4545

4646
self._query.update(f'INTO `{table}`')
4747

Diff for: sqlx/sql/mixin/join.py renamed to sqls/sql/mixin/join.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Union, overload, Self, Literal
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Column, Schema
77

88

@@ -49,7 +49,7 @@ def join(
4949
elif table := getattr(table, '__table__', None):
5050
...
5151
else:
52-
raise NotImplementedError('No matching @overload found for `sqlx.join(...)`')
52+
raise NotImplementedError('No matching @overload found for `sqls.join(...)`')
5353

5454
self._query.update(f'{type} JOIN `{table}`')
5555

@@ -88,7 +88,7 @@ def on(
8888
/,
8989
):
9090
if not isinstance(on, (str, Column)):
91-
raise NotImplementedError('No matching @overload found for `sqlx.on(...)`')
91+
raise NotImplementedError('No matching @overload found for `sqls.on(...)`')
9292

9393
self._query.update(f'ON {on}')
9494

Diff for: sqlx/sql/mixin/limit.py renamed to sqls/sql/mixin/limit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Schema
77

88

Diff for: sqlx/sql/mixin/offset.py renamed to sqls/sql/mixin/offset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Schema
77

88

Diff for: sqlx/sql/mixin/order_by.py renamed to sqls/sql/mixin/order_by.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Union, overload, Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Column, Schema
77

88

@@ -53,7 +53,7 @@ def order_by(
5353
elif kwargs:
5454
columns = ', '.join(f'{column} {order.upper()}' for column, order in kwargs.items())
5555
else:
56-
raise NotImplementedError('No matching @overload found for `sqlx.order_by(...)`')
56+
raise NotImplementedError('No matching @overload found for `sqls.order_by(...)`')
5757

5858
self._query.update(f'ORDER BY {columns}')
5959

Diff for: sqlx/sql/mixin/returning.py renamed to sqls/sql/mixin/returning.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Union, overload, Self
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Column, Schema
77

88

Diff for: sqlx/sql/mixin/values.py renamed to sqls/sql/mixin/values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Self, overload, Union, Any, Iterable
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Schema, Column
77

88

Diff for: sqlx/sql/mixin/where.py renamed to sqls/sql/mixin/where.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Any, Union, Self, overload
44

5-
from sqlx.core.result import Result
5+
from sqls.core.result import Result
66
from ...types import Column, Schema
77

88

@@ -64,7 +64,7 @@ def where(
6464
conditions = ''.join(f'`{column}` = %s' for column in as_dict.keys())
6565
values = as_dict.values()
6666
else:
67-
raise NotImplementedError('Most likely, invalid usage of `sqlx.where`')
67+
raise NotImplementedError('Most likely, invalid usage of `sqls.where`')
6868

6969
self._query.update(f'WHERE {conditions}')
7070
self._args.update(*values)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sqlx/sql/queries/update.py renamed to sqls/sql/queries/update.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class UpdateQuery(
4545
# elif issubclass(table, Schema):
4646
# table = table.__table__
4747
# else:
48-
# raise NotImplementedError('No matching @overload found for `sqlx.update(...)`')
48+
# raise NotImplementedError('No matching @overload found for `sqls.update(...)`')
4949
#
5050
# self._query.update(f'UPDATE {table}')
5151
#
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sqlx/sql/vendor/count.py renamed to sqls/sql/vendor/count.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ def count(
4040
elif table := getattr(table, '__table__', None):
4141
...
4242
else:
43-
raise NotImplementedError('No matching @overload found for `sqlx.update(...)`')
43+
raise NotImplementedError('No matching @overload found for `sqls.update(...)`')
4444

4545
return CountQuery(pool=self.pool, query=f'SELECT COUNT(*) AS `total` FROM `{table}`')
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sqlx/sql/vendor/update.py renamed to sqls/sql/vendor/update.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ def update(
4040
elif table := getattr(table, '__table__', None):
4141
...
4242
else:
43-
raise NotImplementedError('No matching @overload found for `sqlx.update(...)`')
43+
raise NotImplementedError('No matching @overload found for `sqls.update(...)`')
4444

4545
return UpdateQuery(pool=self.pool, query=f'UPDATE `{table}`')
File renamed without changes.

Diff for: sqlx/sql/vendor/vendor.py renamed to sqls/sql/vendor/vendor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any, Iterable
22

3-
from sqlx.core.result import Result
3+
from sqls.core.result import Result
44

55
from .count import CountVendor
66
from .insert import InsertVendor
@@ -20,7 +20,7 @@ class SQLVendor(
2020
):
2121
def __call__(self, query: str, args: Iterable[Any] = ()) -> Result:
2222
"""
23-
>>> sqlx('SELECT * FROM `table` WHERE id = %s;', (1, ))
23+
>>> sqls('SELECT * FROM `table` WHERE id = %s;', (1, ))
2424
:param query:
2525
:param args:
2626
:return:
File renamed without changes.

Diff for: sqlx/types/args.py renamed to sqls/types/args.py

File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sqlx/types/row.py renamed to sqls/types/row.py

File renamed without changes.
File renamed without changes.

Diff for: sqlx/__init__.py

-2
This file was deleted.

Diff for: tests/conftest.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
import pytest_asyncio as aiopytest
33
from pydantic import Field
44

5-
from sqlx import SQLX, Schema
5+
from sqls import SQLS, Schema
66

77

88
@aiopytest.fixture(scope='session')
9-
async def sqlx():
10-
_sqlx = SQLX(
9+
async def sqls():
10+
_sqls = SQLS(
1111
db='test',
1212
user='root',
1313
password='password',
1414
)
15-
async with _sqlx as _cnn:
15+
async with _sqls as _cnn:
1616
await _cnn('''
1717
CREATE TABLE IF NOT EXISTS `user` (
1818
`id` int(11) PRIMARY KEY AUTO_INCREMENT,
@@ -21,7 +21,7 @@ async def sqlx():
2121
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2222
''').execute()
2323

24-
yield _sqlx
24+
yield _sqls
2525

2626

2727
class User(Schema):

Diff for: tests/test_batch.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import pytest
22

3-
from sqlx import SQLX
3+
from sqls import SQLS
44
from .conftest import User
55

66

77
@pytest.mark.asyncio(scope='session')
8-
async def test_batch_direct(sqlx: SQLX) -> None:
9-
async with sqlx as cnn:
8+
async def test_batch_direct(sqls: SQLS) -> None:
9+
async with sqls as cnn:
1010
users = await cnn(
1111
'INSERT INTO `user` (username, password) VALUES (%s, %s)',
1212
('username', 'password'),
@@ -20,8 +20,8 @@ async def test_batch_direct(sqlx: SQLX) -> None:
2020

2121

2222
@pytest.mark.asyncio(scope='session')
23-
async def test_batch_indirect(sqlx: SQLX) -> None:
24-
async with sqlx as cnn:
23+
async def test_batch_indirect(sqls: SQLS) -> None:
24+
async with sqls as cnn:
2525
users = await cnn.insert(User).values(username='u', password='p')
2626
print(users)
2727
users = await cnn.insert(User).values(username='u', password='p')

0 commit comments

Comments
 (0)