19 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: SQLAlch. + ODBC + DB...
FromSent OnAttachments
durumdara26 Apr 2007 02:35 
Michael Bayer26 Apr 2007 05:49 
Durumdara26 Apr 2007 06:35 
Michael Bayer26 Apr 2007 08:14 
Rick Morrison26 Apr 2007 08:32 
Paul Johnston26 Apr 2007 09:51 
Rick Morrison26 Apr 2007 14:53 
Michael Bayer26 Apr 2007 14:58 
Rick Morrison26 Apr 2007 15:14 
Michael Bayer26 Apr 2007 15:28 
Rick Morrison26 Apr 2007 15:31 
Durumdara26 Apr 2007 23:48 
Rick Morrison27 Apr 2007 07:07 
Michael Bayer27 Apr 2007 09:23 
Rick Morrison27 Apr 2007 09:40 
Paul Johnston01 May 2007 12:42 
Rick Morrison01 May 2007 13:16 
Michael Bayer01 May 2007 13:36 
Rick Morrison01 May 2007 15:20 
Subject:[sqlalchemy] Re: SQLAlch. + ODBC + DBISAM... :-(
From:Michael Bayer (mike@zzzcomputing.com)
Date:04/26/2007 08:14:20 AM
List:com.googlegroups.sqlalchemy

On Apr 26, 2007, at 9:35 AM, Durumdara wrote:

Hi!

2007/4/26, Michael Bayer <mike@zzzcomputing.com>:

mssql:// supports pyodbc.

And how to I open the engine? (XXX is the name of the ODBC DataSource what I want to open. It is DBISAM database).

from sqlalchemy import * import pyodbc db = create_engine('mssql://zeusweb', module=pyodbc)

The result is:

use the trunk first of all since MS-SQL support is largely experimental, the "import" is already included in there so it should use pyodbc automatically (you can add the argument 'module_name="pyodbc"` to create_engine() to force it), and I dont know anything about pyodbc so the function that breaks the URL into odbc, given a URL of the form:

mssql://user:password@host/database

is:

def make_connect_string(self, keys): connectors = ["Driver={SQL Server}"] connectors.append("Server=%s" % keys.get("host")) connectors.append("Database=%s" % keys.get("database")) user = keys.get("user") if user: connectors.append("UID=%s" % user) connectors.append("PWD=%s" % keys.get("password", "")) else: connectors.append ("TrustedConnection=Yes")