On 12/04/2015 07:25 AM, Thijs Engels wrote:
> Dear all,
> 
> For maintenance purposes I have aiming to ensure that ALL database
> constraint have an explicit name (as recommended here as well:
> http://alembic.readthedocs.org/en/latest/naming.html)
> 
> With the NOT NULL constraints this can be done by adding an explicit
> CheckConstraint. However at least for Oracle the database ends up with
> one constraint which is added by the Primary Key. Is there a way to
> either avoid this automated creation (and add the NOT NULL constraint
> manually) or if not; is it possible to explicitly provide a name for
> this constraint?
> 
> class Example(Base):
>     __tablename__ = "example"
>     __table_args__ = (
>         PrimaryKeyConstraint("entry_id", name="example_pk"),
>         CheckConstraint('"ENTRY_ID" IS NOT NULL',
>         name="example_entry_nn"))
> 
>     id = Column("entry_id", Integer)
>     name = Column(String(64))
> 
> (not claiming the explicit not null constraint is the prettiest, but it
> does give the result I am after)
> 
> When looking at this database SQL Developer indicates these constraints:
> 
> EXAMPLE_PK         Primary_Key
> EXAMPLE_ENTRY_NN   Check        "ENTRY_ID" IS NOT NULL
> SYS_C00109085      Check        "ENTRY_ID" IS NOT NULL
> 
> Question is how to get rid of the constraint with the generated name
> (SYS_C00109085)...

can you illustrate what raw DDL would like like that you'd want here?
Gabor's idea looks interesting but in any case the rendering of the
column in CREATE TABLE can be fully overridden.



> 
> Thanks in advance,
> 
> Thijs
> 

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to