I'm connecting to an SQL Server database from SQL Alchemy by creating an 
engine as follows:
connectionString = 
'mssql+pyodbc://username:password@my_server/my_database_name'
engine = sql.create_engine(connectionString)

I've noticed that SQL Alchemy defaults to using the 'SQL Server' driver 
when creating the connection string for PyODBC, which creates problems when 
I'm accessing columns stored in DateTime2 format - they are returned as 
strings instead of python datetimes.

To work around this, I can specify a newer driver manually as follows:
connectionString = 
'mssql+pyodbc://username:password@my_server/my_database_name?driver=SQL 
Server Native Client 10.0

However, is there a reason why SQL Alchemy doesn't choose the newest 
available driver by default?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to