sqlalchemy-singlestoredb 1.2.2__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/PKG-INFO +1 -1
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/pyproject.toml +1 -1
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/__init__.py +1 -1
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/base.py +4 -2
- sqlalchemy_singlestoredb-1.2.3/sqlalchemy_singlestoredb/tests/test_connect_args.py +85 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/PKG-INFO +1 -1
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/SOURCES.txt +1 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/LICENSE +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/README.md +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/setup.cfg +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/column.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/compat.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/ddlelement.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/dtypes.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/shard_key_examples.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/table_constructor_examples.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/universal/main.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/reflection.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/__init__.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/conftest.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/run_all_tests.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test.sql +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_advanced_indexes.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_basics.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_column_group.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_connect_retry.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_database_fixtures.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_declarative_reflection.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_error_handling.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_error_handling_pytest.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_integration_features.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_json_type.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_key_reflection.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_persisted_column.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_priority1_features.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_shard_key.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_sort_key.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_table_options.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_table_types.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_vector_key.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_vector_type.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/utils.py +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/dependency_links.txt +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/entry_points.txt +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/requires.txt +0 -0
- {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/top_level.txt +0 -0
{sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/base.py
RENAMED
|
@@ -533,10 +533,12 @@ class _myconnpyBIT(BIT):
|
|
|
533
533
|
|
|
534
534
|
def render_as_string(url: URL) -> str:
|
|
535
535
|
s = url.drivername + '://'
|
|
536
|
+
# safe='' so a / in the user or password is escaped too; left bare,
|
|
537
|
+
# it ends the authority and the rest is misread as host and port.
|
|
536
538
|
if url.username is not None:
|
|
537
|
-
s += quote(url.username)
|
|
539
|
+
s += quote(url.username, safe='')
|
|
538
540
|
if url.password is not None:
|
|
539
|
-
s += ':' + quote(str(url.password))
|
|
541
|
+
s += ':' + quote(str(url.password), safe='')
|
|
540
542
|
s += '@'
|
|
541
543
|
if url.host is not None:
|
|
542
544
|
if ':' in url.host:
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Tests for the connection parameters built from a SQLAlchemy URL."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from sqlalchemy.engine import make_url
|
|
9
|
+
from sqlalchemy.engine import URL
|
|
10
|
+
|
|
11
|
+
from sqlalchemy_singlestoredb import dialect
|
|
12
|
+
|
|
13
|
+
CREDENTIALS = [
|
|
14
|
+
'plain',
|
|
15
|
+
'a/b',
|
|
16
|
+
'a@b',
|
|
17
|
+
'a:b',
|
|
18
|
+
'a+b',
|
|
19
|
+
'a b',
|
|
20
|
+
'a%b',
|
|
21
|
+
'a%2Fb',
|
|
22
|
+
'a?b',
|
|
23
|
+
'a#b',
|
|
24
|
+
'/@:+ %?#',
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def connect_args(url: URL) -> Dict[str, Any]:
|
|
29
|
+
args, kwargs = dialect().create_connect_args(url)
|
|
30
|
+
assert args == []
|
|
31
|
+
return kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.mark.parametrize('password', CREDENTIALS)
|
|
35
|
+
def test_password_round_trips(password: str) -> None:
|
|
36
|
+
url = URL.create(
|
|
37
|
+
'singlestoredb', username='admin', password=password,
|
|
38
|
+
host='example.com', port=3306, database='db',
|
|
39
|
+
)
|
|
40
|
+
out = connect_args(url)
|
|
41
|
+
assert out['user'] == 'admin'
|
|
42
|
+
assert out['password'] == password
|
|
43
|
+
assert out['host'] == 'example.com'
|
|
44
|
+
assert out['port'] == 3306
|
|
45
|
+
assert out['database'] == 'db'
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@pytest.mark.parametrize('user', CREDENTIALS)
|
|
49
|
+
def test_user_round_trips(user: str) -> None:
|
|
50
|
+
url = URL.create(
|
|
51
|
+
'singlestoredb', username=user, password='pw',
|
|
52
|
+
host='example.com', port=3306,
|
|
53
|
+
)
|
|
54
|
+
out = connect_args(url)
|
|
55
|
+
assert out['user'] == user
|
|
56
|
+
assert out['password'] == 'pw'
|
|
57
|
+
assert out['host'] == 'example.com'
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_slash_in_password_from_url_string() -> None:
|
|
61
|
+
# SQLAlchemy accepts an unescaped / in the password of a URL string.
|
|
62
|
+
url = make_url('singlestoredb://admin:a/b@example.com:3306/db')
|
|
63
|
+
assert url.password == 'a/b'
|
|
64
|
+
out = connect_args(url)
|
|
65
|
+
assert out['password'] == 'a/b'
|
|
66
|
+
assert out['host'] == 'example.com'
|
|
67
|
+
assert out['database'] == 'db'
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_empty_password_is_kept() -> None:
|
|
71
|
+
url = URL.create(
|
|
72
|
+
'singlestoredb', username='admin', password='',
|
|
73
|
+
host='example.com', port=3306,
|
|
74
|
+
)
|
|
75
|
+
assert connect_args(url)['password'] == ''
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_ipv6_host() -> None:
|
|
79
|
+
url = URL.create(
|
|
80
|
+
'singlestoredb', username='admin', password='a/b',
|
|
81
|
+
host='::1', port=3306,
|
|
82
|
+
)
|
|
83
|
+
out = connect_args(url)
|
|
84
|
+
assert out['host'] == '::1'
|
|
85
|
+
assert out['password'] == 'a/b'
|
|
@@ -24,6 +24,7 @@ sqlalchemy_singlestoredb/tests/test.sql
|
|
|
24
24
|
sqlalchemy_singlestoredb/tests/test_advanced_indexes.py
|
|
25
25
|
sqlalchemy_singlestoredb/tests/test_basics.py
|
|
26
26
|
sqlalchemy_singlestoredb/tests/test_column_group.py
|
|
27
|
+
sqlalchemy_singlestoredb/tests/test_connect_args.py
|
|
27
28
|
sqlalchemy_singlestoredb/tests/test_connect_retry.py
|
|
28
29
|
sqlalchemy_singlestoredb/tests/test_database_fixtures.py
|
|
29
30
|
sqlalchemy_singlestoredb/tests/test_declarative_reflection.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/column.py
RENAMED
|
File without changes
|
{sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/compat.py
RENAMED
|
File without changes
|
|
File without changes
|
{sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/dtypes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|