Skip to content

Conversation

@living180
Copy link

Description

The fact that instantiating an AddConstrant or DropConstraint instance prevents a constraint that has been included in a table definition from being emitted in a CREATE TABLE statement was undocumented. Remedy by expanding the docstrings for those classes.

Checklist

This pull request is:

  • A documentation / typographical / small typing error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

The fact that instantiating an AddConstrant or DropConstraint instance
prevents a constraint that has been included in a table definition from
being emitted in a CREATE TABLE statement was undocumented.  Remedy by
expanding the docstrings for those classes.
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a bit verbose but it's fine for me

@CaselIT CaselIT requested a review from zzzeek February 18, 2025 18:50
@zzzeek
Copy link
Member

zzzeek commented Feb 27, 2025

The fact that instantiating an AddConstrant or DropConstraint instance prevents a constraint that has been included in a table definition from being emitted in a CREATE TABLE statement was undocumented.

this is news to me. Please report a bug? thanks

@zzzeek zzzeek closed this Feb 27, 2025
@zzzeek
Copy link
Member

zzzeek commented Feb 27, 2025

this seems to be some ancient rule buried in schema which we should consider removing, or turning into some explicit flag

https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5730 will see how far this change goes

@living180
Copy link
Author

It seems that the current form of the behavior comes from f9cb6f5 (see the comment at f9cb6f5#diff-e9a75a522975378e61405c5f9bf62e6241b8fe24f21eefd83bf4987a56f82e70R1279 for the rationale). Prior to that, the inline_ddl attribute was used to accomplish the same thing, which I've been able to be able to trace back as far as 8fc5005.

@zzzeek
Copy link
Member

zzzeek commented Feb 27, 2025

so what I want to do here is add a parameter to the add/drop constraint that defaults to True which controls the behavior. that way the parameter will document that this thing is happening, and it can be turned off. i can open an issue for that

@zzzeek
Copy link
Member

zzzeek commented Feb 27, 2025

#12382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants