On 05/09/2016 10:51 AM, Piotr Dobrogost wrote:
At http://stackoverflow.com/q/870925/95735 there's a question titled
"How to generate a file with DDL in the engine's SQL dialect in
SQLAlchemy?"with the answer which gives the following code:

engine = create_engine( 'mssql+pyodbc://./MyDb', strategy='mock',
executor= lambda sql, *multiparams, **params: print (sql)

In my case engine comes "from outside" so in order to make use of the
above code I would have to clone engine changing only 'strategy' and
'executor'. I see  neither Engine.clone() method nor a parameter to
create_engine() taking already existing engine as a template on which
the new engine would be based upon. Is there any way to do such a copy
and modification?
Is the answer above still the best way to get DDL resulting from calling
create_all()?

the only thing that is sigificant with "mock" is the first part of the URL. You can just send the whole URL though, so just like this:


mock_engine = create_engine(real_engine.url, strategy="mock", ...)







Best regards,
Piotr Dobrogost

--
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
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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