Skip to content

support reflection of PG 10 partitioned tables #4237

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by alsenchenko

Postgresql 10 has introduced new relkind 'p' for a partitioned table.
Sqlalchemy selects 'r' , 'v', 'm', 'f' tables.


Attachments: patch.diff

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by alsenchenko:

  • added labels: postgres
sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

please read the bug reporting guidelines and reopen with the correct format, thanks!

sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

example:

dv = Table(
    'data_values', metadata,
    Column('modulus', Integer, nullable=False),
    Column('data', String(30)),
    postgresql_partition_by='range(modulus)')

from sqlalchemy import event, DDL

event.listen(
    dv,
    "after_create",
    DDL("CREATE TABLE data_values_4_10 PARTITION OF data_values "
        "FOR VALUES FROM (4) TO (10)")
)

# ... after the create

dv = Table("data_values", m, autoload_with=testing.db)

print(CreateTable(dv))

CREATE TABLE data_values (
	modulus INTEGER NOT NULL, 
	data VARCHAR(30)
)

two problems: 1. we aren't getting the partition_by expression and 2. we can't reflect data_values_4_10. We need at least a solution for #1

sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to reopened
sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • removed labels: bug
  • added labels: feature
sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed title from "Couldn't reflect postgres table. PG 10" to "support reflection of PG 10 partitioned tables"
sqlalchemy-bot

sqlalchemy-bot commented on Apr 16, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • set milestone to "1.3"
sqlalchemy-bot

sqlalchemy-bot commented on Oct 1, 2018

@sqlalchemy-bot
CollaboratorAuthor
sqlalchemy-bot

sqlalchemy-bot commented on Oct 2, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

Add reflection support for Postgresql partitioned tables

Added rudimental support for reflection of Postgresql
partitioned tables, e.g. that relkind='p' is added to reflection
queries that return table information.

Fixes: #4237
Change-Id: I66fd10b002e4ed21ea13b13a7e35a85f66bdea75

f1ca155

sqlalchemy-bot

sqlalchemy-bot commented on Oct 2, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
added this to the 1.3 milestone on Nov 27, 2018

1 remaining item

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          support reflection of PG 10 partitioned tables · Issue #4237 · sqlalchemy/sqlalchemy