Code review comment for lp:~lifeless/storm/with

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

> 1. The user should be able to create an object that acts
> similar to a table class to use the feature. Something like:
(...)
> The WithTable object would compile similar to a normal table,
> but note that it had been used in the state object. The compile
> function for Select() could then generate the WITH clause if any
> such tables have been referenced by the query.

Thanks James. That's exactly right.

In your example, WithTable could be defined as something like this:

    table = With("...definition...")
    WithTable = ClassAlias(cls, table)

also, normal classes could be defined with:

    table = With("...definition...")
    class Person(object):
        __storm_table__ = table

and could be used in finds in an equivalent way:

    table = With("...definition...")
    store.using(table).find(...)

> 2. How do we create a WithTable? It would need the following information:
(...)
> * a list of the column names. Do we also want the column types?

I don't think we need the column names, in the same way we don't have the
column names for normal tables. As long as it behaves like a table, we can
use the standard machinery to handle it.

« Back to merge proposal