Skip to content

Commit

Permalink
db: replace SQLAlchemy deprecated contextual_connect method
Browse files Browse the repository at this point in the history
  • Loading branch information
juarezr committed Mar 24, 2021
1 parent ff6e7a3 commit 46a98e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions petl/io/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _iter_dbapi_cursor(cursor, query, *args, **kwargs):


def _iter_sqlalchemy_engine(engine, query, *args, **kwargs):
return _iter_sqlalchemy_connection(engine.contextual_connect(), query,
return _iter_sqlalchemy_connection(engine.connect(), query,
*args, **kwargs)


Expand Down Expand Up @@ -541,7 +541,7 @@ def _todb_dbapi_cursor(table, cursor, tablename, schema=None, commit=True,
def _todb_sqlalchemy_engine(table, engine, tablename, schema=None, commit=True,
truncate=False):

_todb_sqlalchemy_connection(table, engine.contextual_connect(), tablename,
_todb_sqlalchemy_connection(table, engine.connect(), tablename,
schema=schema, commit=commit, truncate=truncate)


Expand Down
2 changes: 1 addition & 1 deletion petl/io/db_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def _execute_sqlalchemy_connection(sql, connection, commit):


def _execute_sqlalchemy_engine(sql, engine, commit):
_execute_sqlalchemy_connection(sql, engine.contextual_connect(), commit)
_execute_sqlalchemy_connection(sql, engine.connect(), commit)


def _execute_sqlalchemy_session(sql, session, commit):
Expand Down
2 changes: 1 addition & 1 deletion petl/io/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _is_dbapi_cursor(dbo):


def _is_sqlalchemy_engine(dbo):
return (_hasmethods(dbo, 'execute', 'contextual_connect', 'raw_connection')
return (_hasmethods(dbo, 'execute', 'connect', 'raw_connection')
and _hasprop(dbo, 'driver'))


Expand Down

0 comments on commit 46a98e6

Please sign in to comment.