On Mon, Nov 16, 2020, at 12:36 PM, Terrence-Monroe: Brannon wrote: > I've been using the SA ORM for 3 months simply declaring tables as you see > here: > > https://docs.sqlalchemy.org/en/13/orm/tutorial.html#declare-a-mapping > > And then connecting to Oracle via oracle://user:pass@server > with no problem. > > However, today, I was told that my auto-generated queries were failing > because they were not qualified with the schema name. I.e, even though > > SELECT some_column FROM some_table > > was working, I am now being asked to make the query > > SELECT some_volumn FROM SCHEMA."some_table" > > and even though there are docs about specifying the schema for the SQLAlchemy > core, I dont see similar docs for the ORM.
Also, that sounds suspicious, if your queries are "working", have you been querying from the wrong set of tables ? There is a default "owner" that's set up when you connect to Oracle and that's what that name signifies. if they are moving the "owner" or something then you'd log in as that other owner most ideally. I'm otherwise not sure why "someone" is telling you your working queries need to change. otherwise I have seen the approach where DBAs make synonyms to all the tables/views, but specifying the owner explicitly works as well. > > I found an answer: > https://stackoverflow.com/questions/62165654/set-current-schema-for-oracle-connection-using-sqlalchemy > > but I cannot believe that I need to manually issue this sort of query for > this: > session.execute(f"ALTER SESSION SET CURRENT_SCHEMA = {schema!s}") > > > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/2c9b94dc-3477-4a0e-b1a6-e31a229fd04fn%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/2c9b94dc-3477-4a0e-b1a6-e31a229fd04fn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/d135a17c-0c59-47bf-8471-a05dd2d0835f%40www.fastmail.com.
