I'm not sure this is going to work: Just because you can access a database
via ODBC doesn't mean it's magically going to speak a particular dialect of
SQL.

ODBC abstracts database connection mechanisms, preparing and executing
statements, binding parameters and other "middleware"-oriented tasks,
but it does not provide an SQL esperanto.
(SA itself is one of the few tools that does a credible job of that....)

What SA's
pyodbc+MS-SQL module does is allow one to use *MS-SQL* via ODBC, not
any database capable of communicating over ODBC. Were
there such a thing, a sufficiently MS-SQL like database would work, but all
the MS-SQL'isms that the SA MSSQL module provides are for the benefit of
MS-SQL, not ODBC.



On 4/26/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
> 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