from elixir import *
from sqlalchemy import create_engine
engine = create_engine("sqlite:///" )
engine.echo = True
metadata.bind = engine
session.configure( bind = engine )
#then define your entities
class MyEntity( Entity ):
..............
setup_all()
create_all()
#now, you can execute arbitrary sql statements in your python class like this
way:
s = text( """insert into station_type (id, name) values (%d,'%s')""" %
(id,name) )
session.execute(s)
session.commit()
or operate on your entities directly:
s = YourEntity()
session.merge(s)
session.commit()
> Hi,
>
> I have an all-Elixir application and would like to map some
> arbitrary select statements to python classes. Can this be
> done with Elixir, or do I need plain sqlalchemy for this ?
>
> Does anybody has an example of how to mix Elixir mappings
> and plain Sqlalchemy mappings ?
>
> Thanks,
>
> Erik
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---