On Thu, Jul 3, 2008 at 11:23 AM, alex bodnaru <[EMAIL PROTECTED]> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > Gaetan de Menten wrote: > | On Fri, Jun 27, 2008 at 6:29 PM, alex bodnaru <[EMAIL PROTECTED]> wrote: > | > |> please let me know, whether any part of the registered actions in elixir > |> (through extensions api) are activated at the sa level, or only when > |> manipulating the data through elixir. > | > | I'm not sure I understand the question... All Elixir's extensions (I > | guess you mean the "statements" system or maybe the "builder" stuff) > | are only taken care of by Elixir code. I mean that if you use > | something like "using_options(xxx=yyy)" on an raw SA mapped class, it > | will be simply ignored. > | But, of course, all those extensions, when processed by Elixir end up > | calling SA code. > | > for example, the versioning extension is setting version = 1 at insert time. > but i found the answer, and it's no: an insert statement at sa level wouldn't > set version==1 :(
To be clear, that would work through sa's "orm" part (see below). > |> secondly, could i set a record filter through an extension? again, would > it be > |> possible to activate it at sa level (and-ed with the where filter in select > |> statements)? > | > | Sorry, but this time I really don't understand the question... Through > | an extension, you can modify the generated mapper and table objects in > | any way you like. If "setting a record filter" (whatever that is) > | falls within those limits, then yes you can. > | > i was thinking at a record filter based on some logic. but it will anyway work > at elixir level only. > > | You might be interested in the following page: > | http://elixir.ematia.de/trac/wiki/BehindTheScene > | > > so my conclusion would be to insert/update (think versioning) at the elixir > level only, while selects may be used freely at sa level too. > > what remains to be checked, whether the sa guys would allow reistering > before_insert/update actions, then it would be nice to hook the elixir based > extensions deeper in the sa orm. I think you are confusing the two levels of abstraction SQLAlchemy provides and Elixir. Or maybe this was all already clear to you and I didn't understand what you meant... For the record: SA provides an SQL toolkit, which is just a way to express SQL constructs in a pythonic way: >>> s = select([users, addresses], users.c.id==addresses.c.user_id) sql>>> for row in conn.execute(s): ... print row SQLAlchemy also provide an ORM, which maps python objects with table rows. Elixir is *not* another ORM on top of SA. It only provides a different syntax to uses the ORM provided by SQLAlchemy. The before_insert extensions are no exception, they are exposing in a simple way a feature from the ORM SQLAlchemy provides (namely MapperExtensions). -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" 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/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
