Skip to content

10909 postgresql dialect table options #12584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ovangle
Copy link

@ovangle ovangle commented May 12, 2025

Description

Implements PGDialect.get_table_options, PGDialect.get_multi_table_options and attempts to properly reflect the following dialect specific options passed to the Table constructor

  • postgresql_inherits
  • postgresql_with
  • postgresql_with_oids (in supported versions)
  • postgresql_using
  • postgresql_tablespace

No attempt was made to reflect postgresql_partition_by, as the option is passed as a text string and would be difficult to replicate effectively (also, it's kind of useless without also reflecting postgresql_partition_of, but I'd make an attempt at implementing declarative partitioning for postgres if there was interest.

Also adds support for passing table storage parameters to PGDDLCompiler.post_create_table to the compiler.

Fixes issue #10909

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.

Have a nice day!

ovangle added 2 commits May 12, 2025 12:11
These seem to be the most useful table options to pass in most
cases anyway. Reflects the implementation in PGDDLCompiler
Reflect dialect specific options passed to `Table` constructor

Table options reflected:
- postgresql_inherits
- postgresql_with
- postgresql_with_oids (in supported versions)
- postgresql_using
- postgresql_tablespace

Fixes sqlalchemy#10909
@CaselIT
Copy link
Member

CaselIT commented May 14, 2025

Hi,

I've given it a quick glance and great work so far. I'll try taking a better look this week

- Add pg_tablespace, pg_inherits tables to pg_catalog (not committed
  originally)
- Add test for table using non-default access method
- Remove commented code
- Correct formatting errors in docs
@ovangle
Copy link
Author

ovangle commented May 16, 2025

Cleaned up the implementation slightly, removing commented code and adding a simple test for a table using a non-default access method. Also, I didn't commit the tables I added to pg_catalog.

@ovangle ovangle closed this Jun 18, 2025
@CaselIT
Copy link
Member

CaselIT commented Jun 18, 2025

I'm interested in finishing this, so I'll keep it open

@CaselIT CaselIT reopened this Jun 18, 2025
@ovangle ovangle closed this Jun 18, 2025
@ovangle ovangle deleted the 10909-postgresql-dialect-table-options branch June 18, 2025 07:45
@CaselIT CaselIT requested a review from sqla-tester June 18, 2025 20:17
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision c629f98 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Failed to create a gerrit review, git squash against branch 'main' failed

@ovangle ovangle restored the 10909-postgresql-dialect-table-options branch June 20, 2025 09:21
@ovangle ovangle reopened this Jun 20, 2025
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