On Sep 13, 2010, at 2:48 PM, Gregg Lind wrote:
>
> Suppose this is my table:
>
> a_table = Table(
> 'a_table', metadata,
> Column('ts',Integer, index=True, nullable=False),
> Column('country',String, index=True, nullable=False),
> Column('somestat',Integer,nullable=False),
> PrimaryKeyConstraint('ts','country',name='summary_pk'),
> )
>
> then:
>
>>>> print select([a_table]).where(a_table.c.country=='de')
> SELECT a_table.ts, a_table.country, a_table.somestat
> FROM a_table
> WHERE a_table.country = %(country_1)s
>
> Suppose further that in the Postgres, there are several PARTITIONS
> INHERIT
> from this main table, and I want to query them directly... what is a
> sensible
> way to do this? I can figure out *which* partition to use, based on
> outside
> code, so it doesn't need to be very smart.
>
> As a final answer I want something like:
>
>>>> print <SOMETHING>
> SELECT a_table_PARITION1.ts, a_table_PARITION1.country,
> a_table_PARITION1.somestat
> FROM a_table_PARITION1
> WHERE a_table_PARITION1.country = %(country_1)s
>
> In my head, it is like "oh, use a_table, except sub in a new value
> for
> a_table.name TEMPORARILY".
this is not very hard so I created a recipe for this case:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PartitionTable
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.