On Wed, Jan 29, 2020, at 9:23 AM, Gord Thompson wrote:
> For the external Firebird dialect I am trying to get the following to work. 
> It's really identical to the Oracle equivalent, except for the dialect name, 
> but that's my issue.
> 
> kw = {
>         *"prefixes"*: [*"GLOBAL TEMPORARY"*],
>         *"firebird_on_commit"*: *"PRESERVE ROWS"*,
>     }
> metadata = sa.MetaData()
> user_tmp = sa.Table(
>     *"user_tmp"*,
>     metadata,
>     sa.Column(*"id"*, sa.INT, primary_key=*True*),
>     sa.Column(*"name"*, sa.VARCHAR(50)),
>     sa.Column(*"foo"*, sa.INT),
>     sa.UniqueConstraint(*"name"*, name=*"user_tmp_uq"*),
>     sa.Index(*"user_tmp_ix"*, *"foo"*),
>     **kw
> )
> metadata.create_all(bind=engine)
> 
> I found the place in oracle/base.py (OracleDialect class) where its 
> declarations *appear *to be taking place ...
> 
> construct_arguments = [
>     (
>         sa_schema.Table,
>         {*"resolve_synonyms"*: *False*, *"on_commit"*: *None*, *"compress"*: 
> *False*},
>     ),
>     (sa_schema.Index, {*"bitmap"*: *False*, *"compress"*: *False*}),
> ]
> 
> ... but when I put the same thing for "on_commit" in FBDialect and run my 
> test code I continue to get
> 
>> sqlalchemy.exc.ArgumentError: Argument 'firebird_on_commit' is not accepted 
>> by dialect 'firebird' on behalf of <class 'sqlalchemy.sql.schema.Table'>
> 
> I've tried tracing through the code when hitting an Oracle database (which 
> works) but I'm just not seeing where 'on_commit' becomes a "thing" for the 
> oracle dialect.
> 
> Any suggestions on where else I should look?

the whole thing happens in the sqlalchemy.sql.base.DialectKWArgs class . That 
class will consume the FBDialect.construct_arguments collection directly. It 
requires that the dialect is loaded through the "dialect registry" mentioned in 
README.dialects.rst so perhaps make sure it's loading the correct object; 
"firebird" is likely already matching the one that's inside of SQLAlchemy. you 
might have to force your own dialect on top of it if you are sharing that name 
for now.



> 
> 

> --
>  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/5eeb1cb9-2ae8-47a0-bb1b-85d70db6e204%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/5eeb1cb9-2ae8-47a0-bb1b-85d70db6e204%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/50cb8f7a-575a-49b6-ae1c-3858b1a961d3%40www.fastmail.com.

Reply via email to