missing schema authorization clause

45 views
Skip to first unread message

sumau

unread,
Apr 5, 2023, 6:26:18 PM4/5/23
to sqlalchemy
Hello

Is it possible to pass in the authorization when creating a schema with the oracle dialect?

oracle_engine = create_engine(
f"oracle://{user}:{password}@{host}:{port}/{database_name}"
)
inspector = inspect(oracle_engine)
if schema_name not in inspector.get_schema_names():
oracle_engine.execute(CreateSchema(schema_name))

I tried to pass in the authorization as a kw variable but no luck:

if schema not in inspector.get_schema_names():
connectable.execute(CreateSchema(schema), authorization=user)

Regards
Soumaya

Mike Bayer

unread,
Apr 5, 2023, 6:44:35 PM4/5/23
to noreply-spamdigest via sqlalchemy
I've never heard of this concept before so a google into stack overflow shows https://stackoverflow.com/questions/10994414/missing-authorization-clause-while-creating-schema, where you are probably looking for:

with engine.begin() as conn:
    conn.execute(text("create user {schema_name} identified by {password}"))
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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+...@googlegroups.com.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages