Unfortunately the Sybase dialect is not supported right now, but also I don't 
see anything obviously wrong with the query you have, except perhaps Sybase 
doesn't like that you have a table named "Users" that is using quoting; it is 
possible that it wants a different quoting character, not sure. Or perhaps you 
should be omitting the "dbo" schema, which should be the defaul schema in any 
case. Sorry I can't be of more help.


On Fri, Jul 5, 2019, at 10:11 AM, Ishan Shah wrote:
> I am using the Sybase dialect and trying to read an existing table. After 
> loading the users table as follows, I use the query function to print all the 
> records but I am getting a programming error which is related to pyodbc. My 
> guess is that there is a syntax error here. How do I overcome this? Kindly 
> advise.
> 
> users = Table("Users", metadata, autoload=True, autoload_with=engine, 
> schema='dbo')
> session.query(users).all()
> 
> ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [FreeTDS][SQL 
> Server]Incorrect syntax near 'dbo.Users.'.\n (102) (SQLExecDirectW)")
> [SQL: SELECT dbo."Users".user_id AS "dbo_Users_user_id", 
> dbo."Users".windows_id AS "dbo_Users_windows_id", dbo."Users".first_name AS 
> "dbo_Users_first_name", dbo."Users".last_name AS "dbo_Users_last_name", 
> dbo."Users".user_type AS "dbo_Users_user_type", dbo."Users".domain AS 
> "dbo_Users_domain", dbo."Users".active AS "dbo_Users_active"
FROM dbo."Users"]
> 

> --
>  SQLAlchemy - 
>  The Python SQL Toolkit and Object Relational Mapper
> 
> http://www.sqlalchemy.org/
> 
>  To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
>  --- 
>  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 https://groups.google.com/group/sqlalchemy.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/d8379326-87b8-43cf-aace-fe94f7926ebe%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/d8379326-87b8-43cf-aace-fe94f7926ebe%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/77a3b016-0226-4d83-a8df-e33978caff8f%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to