- changed component to schema
add API to DialectKWArgs to add new arguments
also make sure the error message points to this
from sqlalchemy.dialects.postgresql import base
base.PGDialect.construct_arguments.append((PrimaryKeyConstraint, {"fillfactor": None}))
Comments (10)
-
reporter -
reporter - changed milestone to 0.9.4
-
reporter Also look into adding an API to allow arguments to be added after the fact, e.g.:
index.kwargs['mysql_length'] = 191
-
reporter confirm that "table.mysql_engine = 'InnoDB'" does not have any effect, that's not the API.
-
"table.mysql_engine = 'InnoDB'" does not work, that was just me being stupid.
-
I tried to do some work on this but made very little headway. To try to get a better understanding of how things work the first thing I did was change the dict underlying
DialectKWArgs
to a standarddict
. Curiously this makes the assigning totable.kwargs['mysql_engine']
impact on the type of table created, butindex.kwargs['mysql_length']
doesn't appear to do anything. I assume this is because of differences between handling in create table andvisit_create_index
handling insqlalchemy/dialects/mysql/base.py
, but I can't be sure.This is the first time I've dug this deeply into the internals and a) I'm impressed b) overwhelmed, so will have to take a break until tomorrow and perhaps some feedback can guide me a bit further.
-
reporter im looking right now and this one is not so easy. DialectKWArgs maintains two different dictionaries and at the moment relies upon being able to generate them just once at construction time. they aren't kept in sync following that. it would have to be rearranged to support this.
-
reporter - changed status to resolved
- The new dialect-level keyword argument system for schema-level constructs has been enhanced in order to assist with existing schemes that rely upon addition of ad-hoc keyword arguments to constructs.
- To suit the use case of allowing custom arguments at construction time,
the :meth:
.DialectKWArgs.argument_for
method now allows this registration. fixes#2962
→ <<cset 33f07202ce2d>>
-
reporter OK this was actually pretty involved. You can again just add keywords to index.kwargs, and there is also a new method <class>.argument_for() which will allow the addition of new constructor arguments.
-
Awesome thank you. Thanks also for making my brain bigger, that is a rather large change set and has quite a bit I can learn from.
- Log in to comment