Closed
Description
Forwarded from: mkleehammer/pyodbc#757
Environment
- Python: 3.7.5
- pyodbc: 4.0.30
- OS: Linux-4.15.0-99-generic-x86_64-with-Ubuntu-18.04-bionic
- DB: sybase (Adaptive Server Enterprise/16.0 SP02)
- driver: FreeTDS
Issue
Forwarded from: sqlalchemy/sqlalchemy#5311
import pyodbc
connect_args = {"autoconnect": True}
connector = pyodbc.connect(
database=database,
user=username,
password=password,
driver="FreeTDS",
host=host,
port=port,
**connect_args,
)
This works:
cnxn = connector.connect()
cursor = cnxn.cursor()
cursor.execute(
"INSERT INTO mytable (type, description, create_date) "
f"VALUES ('TEST', 'TEST', '{datetime.utcnow().isoformat()}')
)
cursor.execute("SELECT @@identity AS lastrowid")
print(cursor.fetchone()[0])
large number
But this fails (returns 0):
cnxn = connector.connect()
cursor = cnxn.cursor()
cursor.execute("INSERT INTO mytable (type, description, create_date) VALUES (?, ?, ?)", 'TEST', 'TEST', '2020-05-06T13:22:43.923404')
cursor.execute("SELECT @@identity AS lastrowid")
print(cursor.fetchone()[0])
0
Any thoughts on if this is a FreeTDS issue or a SYBASE issue?
Metadata
Metadata
Assignees
Labels
No labels