I'm running the code below against an oracle database:

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base, DeferredReflection

Base = declarative_base(cls=DeferredReflection)

class User(Base):
    __tablename__ = 'user'
    __table_args__ = {'schema':'si'}

#Create a session to use the tables    
engine = create_engine('oracle://teste:teste@172.16.1.34:1512/prod')

Base.prepare(engine)

lst_col= [c.name for c in User.__table__.columns]
print (lst_col, len(lst_col))


But I'm getting a warning with the follow message:
python3.6/site-packages/sqlalchemy/dialects/oracle/base.py:1653: SAWarning: 
Got 'None' querying 'table_name' from all_cons_columns - does the user have 
proper rights to the table?

The query runs, but with the warning.

In the tests I made I see that if I give "select any table" privilege to 
the user it runs without any warning, but for security reasons I don't 
wan't to give that kind of privilege that gives the user possibility to 
query any table in the all database. I gave all permissions on that table 
to the "teste" user, and by sql it's possible to query and do any 
operations in the table, also it's possible to do all operation by python 
but with the warning.

Can you please help me find what I doing wrong, or what is the problem?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to