Hi all,
I have set up specific naming conventions in a Flask-Sqlalchemy app using
the metadata argument and it all seems to work except for naming PRIMARY
KEY constraints. Here is what I have
self.db.init_app(app)
self.db.Model.metadata = MetaData(
schema=self.app.config['SQLALCHEMY_DATABASE_SCHEMA'],
naming_convention={
"columns": columns,
"ix": '%(table_name)s_%(columns)s_idx',
"uq": "%(table_name)s_%(columns)s_key",
"fk": "%(table_name)s_%(columns)s_fkey",
"pk": "%(table_name)s_%(columns)s_pkey"
}
)
and the *columns* helper is defined by:
def columns(constraint, table):
return "_".join([col.name for col in constraint.columns])
It works for every single kind except for the *primary key* property of the
naming convention obj. When printed out, the helper receives a constraint
argument that when
print constraint
is added, gives *PrimaryKeyConstraint()* so no columns can be gotten from
it.
Does anyone know what could be causing this? I have a guess that it might
be this flask-sqlalchemy pluging but cannot figure it out.
Thanks a lot!
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.