On Thu, May 17, 2012 at 6:54 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
>
> On May 14, 2012, at 6:32 AM, Ignas Mikalajunas wrote:
>
>> On Sun, May 13, 2012 at 1:05 PM, Michael Bayer <mike...@zzzcomputing.com> 
>> wrote:
>>> Michael Bayer wrote:
>>>>
>>>> On May 11, 2012, at 1:16 PM, Ignas Mikalajunas wrote:
>>>>
>>>>> Even though the latest version of the DeclarativeRefletive example
>>>>> includes some handling for inheritance, I still can not get it to
>>>>> work. I try doing (mostly modified example from
>>>>> https://bitbucket.org/sqlalchemy/sqlalchemy/src/408388e5faf4/examples/declarative_reflection/declarative_reflection.py):
>>>>
>>>>>
>>>>> and sqlalchemy tries to find the type column in the table 'bar'. Am I
>>>>> doing the inheritance set up wrong or is it some bug in
>>>>> DeclarativeReflectiveBase?
>>>>
>>>> would need to spend some time with it, the declarativereflective example
>>>> hasn't been worked out for setting up an inheritance relationship as of
>>>> yet.   So there could be any number of issues with it (part of why it's
>>>> only an example and not a real feature)..
>>>
>>>
>>> this feature will require changes to the declarative extension itself,
>>> which I will attempt to prepare as part of 0.8.  when the feature is done,
>>> the 0.8 version of declarative.py can be used with 0.7 as well in the
>>> interim before 0.8 is released.
>>>
>>
>> I see, thank you very much. I have a very good test case waiting for
>> this feature :)
>
> Okey doke if you want to test against 0.8 tip, here are the docs for the new 
> feature:
>
> http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative.html#sqlalchemy.ext.declarative.DeferredReflection
>
> any issues you find please report and I'll try to get them fixed.

Thanks, everything seems to be working very well.

Small issues so far:

I can't set neither polymorphic_on nor sort_on columns in mapper
properties without defining columns explicitly and that overrides the
reflected columns.

There is no way to ignore just SAWarnings just on some tables now,
only either turn them off for all tables (around prepare call) or
reflect the tables explicitly before calling prepare. (otherwise I
keep getting the warnings for indexes/columns sqlalchemy does not
understand)

the third one required a patch to the prepare method:

      @classmethod
      def prepare(cls, engine):
          """Reflect all :class:`.Table` objects for all current
          :class:`.DeferredReflection` subclasses"""
          to_map = [m for m in _MapperConfig.configs.values()
                      if issubclass(m.cls, cls)]
          for thingy in to_map:
              cls.__prepare__(thingy.args, engine)
+
+         for thingy in to_map:
              thingy.map()


so that all the tables would get defined before models. I can't come
up with an sqlite based testcase at the moment.
Without this some I was having some_table has no column id errors.


Ignas

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to