Hey Rick,

I have written some this.  It doesn't pass all of the tests yet, but
It works pretty well for starters.  I'll send in a few minutes to the
list.

On 2/16/06, Rick Morrision <[EMAIL PROTECTED]> wrote:
> Hi everybody:
>
>  I've begun work on a database engine for MS-SQL (if anyone else is working
> on this, please let me know ASAP).
>
>  One of the issues I've run into is that attempting to do table reflection
> generates an internal query for which MSSQL seems to require a table alias.
>
>  The query, from information_schema.py is:
>
>      s = select([columns],
>          sql.and_(columns.c.table_name==table.name,
> columns.c.table_schema==current_schema)
>          order_by=[columns.c.ordinal_position])
>
>  which for a table named 'SysParms', would generate the following query:
>
>  SELECT columns.table_schema, columns.table_name, columns.column_name,
> columns.is_nullable, columns.data_type, columns.ordinal_position,
> columns.character_maximum_length,
> columns.numeric_precision, columns.numeric_scale, columns.column_default
>  FROM information_schema.columns
>  WHERE columns.table_name = 'SysParms' AND columns.table_schema = 'dbo'
> ORDER BY columns.ordinal_position
>
>  which then fails with a string of:
>
>  Server: Msg 107, Level 16, State 2, Line 1
>  The column prefix 'columns' does not match with a table name or alias name
> used in the query.
>
>  Changing the FROM clause in the query to:
>
>  FROM information_schema.columns AS columns
>
>  Fixes things.
>
>  Now, how do I force the query generator to use a table alias? I've tried
> using:
>
>   columns = columns.alias('columns')
>
>  Which then fails with a "no for clause" error
>
>  Help?
>
>  Thanks,
>  Rick
>
>


--
Runar Petursson
Betur
[EMAIL PROTECTED] -- http://betur.net
301 West 22nd Street Suite 68
New York, NY 10011
+1 (917) 570-1305


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to