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.
Files changed (46) hide show
  1. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/PKG-INFO +1 -1
  2. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/pyproject.toml +1 -1
  3. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/__init__.py +1 -1
  4. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/base.py +4 -2
  5. sqlalchemy_singlestoredb-1.2.3/sqlalchemy_singlestoredb/tests/test_connect_args.py +85 -0
  6. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/PKG-INFO +1 -1
  7. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/SOURCES.txt +1 -0
  8. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/LICENSE +0 -0
  9. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/README.md +0 -0
  10. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/setup.cfg +0 -0
  11. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/column.py +0 -0
  12. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/compat.py +0 -0
  13. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/ddlelement.py +0 -0
  14. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/dtypes.py +0 -0
  15. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/shard_key_examples.py +0 -0
  16. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/table_constructor_examples.py +0 -0
  17. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/examples/universal/main.py +0 -0
  18. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/reflection.py +0 -0
  19. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/__init__.py +0 -0
  20. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/conftest.py +0 -0
  21. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/run_all_tests.py +0 -0
  22. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test.sql +0 -0
  23. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_advanced_indexes.py +0 -0
  24. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_basics.py +0 -0
  25. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_column_group.py +0 -0
  26. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_connect_retry.py +0 -0
  27. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_database_fixtures.py +0 -0
  28. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_declarative_reflection.py +0 -0
  29. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_error_handling.py +0 -0
  30. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_error_handling_pytest.py +0 -0
  31. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_integration_features.py +0 -0
  32. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_json_type.py +0 -0
  33. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_key_reflection.py +0 -0
  34. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_persisted_column.py +0 -0
  35. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_priority1_features.py +0 -0
  36. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_shard_key.py +0 -0
  37. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_sort_key.py +0 -0
  38. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_table_options.py +0 -0
  39. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_table_types.py +0 -0
  40. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_vector_key.py +0 -0
  41. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/test_vector_type.py +0 -0
  42. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb/tests/utils.py +0 -0
  43. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/dependency_links.txt +0 -0
  44. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/entry_points.txt +0 -0
  45. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/requires.txt +0 -0
  46. {sqlalchemy_singlestoredb-1.2.2 → sqlalchemy_singlestoredb-1.2.3}/sqlalchemy_singlestoredb.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy_singlestoredb
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: SQLAlchemy dialect for the SingleStoreDB database
5
5
  Author-email: SingleStore <support@singlestore.com>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = 'sqlalchemy_singlestoredb'
7
- version = '1.2.2'
7
+ version = '1.2.3'
8
8
  description = 'SQLAlchemy dialect for the SingleStoreDB database'
9
9
  readme = 'README.md'
10
10
  requires-python = '>=3.9'
@@ -57,7 +57,7 @@ array = base.array
57
57
  # default dialect
58
58
  dialect = base.dialect
59
59
 
60
- __version__ = '1.2.2'
60
+ __version__ = '1.2.3'
61
61
 
62
62
  __all__ = (
63
63
  'BIGINT',
@@ -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'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy_singlestoredb
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: SQLAlchemy dialect for the SingleStoreDB database
5
5
  Author-email: SingleStore <support@singlestore.com>
6
6
  License-Expression: Apache-2.0
@@ -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