Skip to content

Commit

Permalink
Don't special case for Engine
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Oct 24, 2023
1 parent 3edbcb0 commit 2dfe32c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def create_and_load_postgres_datetz(conn):
Table,
insert,
)
from sqlalchemy.engine import Engine

metadata = MetaData()
datetz = Table("datetz", metadata, Column("DateColWithTz", DateTime(timezone=True)))
Expand All @@ -264,17 +263,10 @@ def create_and_load_postgres_datetz(conn):
},
]
stmt = insert(datetz).values(datetz_data)
if isinstance(conn, Engine):
with conn.connect() as conn:
with conn.begin():
datetz.drop(conn, checkfirst=True)
datetz.create(bind=conn)
conn.execute(stmt)
else:
with conn.begin():
datetz.drop(conn, checkfirst=True)
datetz.create(bind=conn)
conn.execute(stmt)
with conn.begin():
datetz.drop(conn, checkfirst=True)
datetz.create(bind=conn)
conn.execute(stmt)

# "2000-01-01 00:00:00-08:00" should convert to
# "2000-01-01 08:00:00"
Expand Down

0 comments on commit 2dfe32c

Please sign in to comment.