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

> Hi!
>
> 2007/4/26, Michael Bayer <[EMAIL PROTECTED]>:
>
> 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:[EMAIL PROTECTED]/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")



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to