On Sep 3, 2014, at 8:03 AM, Toby <tobycole...@gmail.com> wrote:

> 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 should be using a DSN-connection in any case, the "SQL Server" default 
there was added by someone who wanted to use hostname based connections which I 
am -1 on for ODBC, and if I'm to take any action here, it would be to remove 
that default entirely.    So that wouldn't change the situation on your end, 
you still need to specify it.




-- 
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