Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial sqlalchemy-2.0 support #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endif

tests:
# Run pytest with coverage
@$(VENV_RUN)pytest --cov=. tests
@SQLALCHEMY_WARN_20=1 $(VENV_RUN)pytest --cov=. tests

.PHONY: lint tests

Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
version: '3'
version: "3"

volumes:
pg_data:

services:
postgres:
image: postgres:9.6.3
image: postgres:latest
ports:
- 5543:5432
volumes:
- pg_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgres
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
psycopg2==2.8.3
six==1.12.0
sqlalchemy==1.3.7
psycopg2==2.9.9
six==1.16.0
sqlalchemy==1.4.51
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import find_packages, setup

install_requires = ["psycopg2>=2.7", "six>=1.12.0", "SQLAlchemy>=1.0"]
install_requires = ["psycopg2>=2.7", "six>=1.12.0", "SQLAlchemy>=1.4"]
test_requires = ["pytest", "pytest-cov", "pytest-mock"]
dev_requires = test_requires + [
"autopep8>=1.4.4",
Expand Down Expand Up @@ -30,6 +30,8 @@
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: SQL
Topic :: Database
Topic :: Database :: Front-Ends
Expand Down
2 changes: 1 addition & 1 deletion src/savage/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
text,
)
from sqlalchemy.dialects import postgresql
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import declared_attr
from sqlalchemy.orm.attributes import InstrumentedAttribute

from savage import utils
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import

import pytest
from sqlalchemy import create_engine
from sqlalchemy import create_engine, text

import savage
from savage.utils import savage_json_serializer
Expand Down Expand Up @@ -41,7 +41,7 @@ def session(engine):
# Clean up
_session.close()
for tablename in Base.metadata.tables.keys():
connection.execute("DELETE FROM {}".format(tablename))
connection.execute(text("DELETE FROM {}".format(tablename)))
connection.close()


Expand Down
2 changes: 1 addition & 1 deletion tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
UniqueConstraint,
)
from sqlalchemy.dialects import postgresql
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import declarative_base

from savage.models import SavageLogMixin, SavageModelMixin

Expand Down
Loading