Skip to content

Commit eb3b9e0

Browse files
authored
Merge pull request #702 from kvesteri/release/0.41.0
Release 0.41.0
2 parents 0c158eb + 69ea39e commit eb3b9e0

File tree

8 files changed

+29
-6
lines changed

8 files changed

+29
-6
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: flake8
1515

1616
- repo: https://github.com/pycqa/isort
17-
rev: 5.10.1
17+
rev: 5.11.5
1818
hooks:
1919
- id: isort
2020

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Changelog
44
Here you can see the full list of changes between each SQLAlchemy-Utils release.
55

66

7+
0.41.0 (2023-04-13)
8+
^^^^^^^^^^^^^^^^^^^
9+
10+
- Support psycopg3 for ``create_database()`` and ``delete_database()``.
11+
(#701, pull request by LerikP)
12+
13+
714
0.40.0 (2023-02-12)
815
^^^^^^^^^^^^^^^^^^^
916

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_version():
2727
'Jinja2>=2.3',
2828
'docutils>=0.10',
2929
'flexmock>=0.9.7',
30+
'psycopg>=3.1.8',
3031
'psycopg2>=2.5.1',
3132
'psycopg2cffi>=2.8.1',
3233
'pg8000>=1.12.4',

sqlalchemy_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@
101101
refresh_materialized_view
102102
)
103103

104-
__version__ = '0.40.0'
104+
__version__ = '0.41.0'

sqlalchemy_utils/aggregates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
3737
3838
.. _column_property:
39-
https://docs.sqlalchemy.org/en/latest/orm/mapper_config.html#using-column-property
39+
https://docs.sqlalchemy.org/en/latest/orm/mapped_sql_expr.html#using-column-property
4040
.. _counter_culture: https://github.com/magnusvk/counter_culture
4141
.. _stackoverflow reply by Michael Bayer:
4242
https://stackoverflow.com/a/13765857/520932

sqlalchemy_utils/functions/database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def create_database(url, encoding='utf8', template=None):
556556

557557
if (dialect_name == 'mssql' and dialect_driver in {'pymssql', 'pyodbc'}) \
558558
or (dialect_name == 'postgresql' and dialect_driver in {
559-
'asyncpg', 'pg8000', 'psycopg2', 'psycopg2cffi'}):
559+
'asyncpg', 'pg8000', 'psycopg', 'psycopg2', 'psycopg2cffi'}):
560560
engine = sa.create_engine(url, isolation_level='AUTOCOMMIT')
561561
else:
562562
engine = sa.create_engine(url)
@@ -625,7 +625,7 @@ def drop_database(url):
625625
if dialect_name == 'mssql' and dialect_driver in {'pymssql', 'pyodbc'}:
626626
engine = sa.create_engine(url, connect_args={'autocommit': True})
627627
elif dialect_name == 'postgresql' and dialect_driver in {
628-
'asyncpg', 'pg8000', 'psycopg2', 'psycopg2cffi'}:
628+
'asyncpg', 'pg8000', 'psycopg', 'psycopg2', 'psycopg2cffi'}:
629629
engine = sa.create_engine(url, isolation_level='AUTOCOMMIT')
630630
else:
631631
engine = sa.create_engine(url)

sqlalchemy_utils/types/ts_vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Article(Base):
7878
Would be equivalent to SQL::
7979
8080
81-
search_vector @@ to_tsquery('pg_catalog.simgle', 'finland')
81+
search_vector @@ to_tsquery('pg_catalog.simple', 'finland')
8282
8383
"""
8484
impl = TSVECTOR

tests/functions/test_database.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
import sqlalchemy as sa
33

44
from sqlalchemy_utils import create_database, database_exists, drop_database
5+
from sqlalchemy_utils.compat import get_sqlalchemy_version
56

67
pymysql = None
78
try:
89
import pymysql # noqa
910
except ImportError:
1011
pass
1112

13+
sqlalchemy_version = get_sqlalchemy_version()
14+
1215

1316
class DatabaseTest:
1417
def test_create_and_drop(self, dsn):
@@ -98,6 +101,18 @@ def dsn(self, postgresql_db_user, postgresql_db_password):
98101
)
99102

100103

104+
@pytest.mark.skipif('sqlalchemy_version < (2, 0, 0)')
105+
class TestDatabasePostgresPsycoPG3(DatabaseTest):
106+
107+
@pytest.fixture
108+
def dsn(self, postgresql_db_user, postgresql_db_password):
109+
return 'postgresql+psycopg://{}:{}@localhost/{}'.format(
110+
postgresql_db_user,
111+
postgresql_db_password,
112+
'db_to_test_create_and_drop_via_psycopg3_driver'
113+
)
114+
115+
101116
@pytest.mark.usefixtures('postgresql_dsn')
102117
class TestDatabasePostgresWithQuotedName(DatabaseTest):
103118

0 commit comments

Comments
 (0)