4

My sqlalchemy is 0.6.3, and elixir is 0.7.1

I created a model class which extends Entity:

from elixir import *
class User(Entity):
    pass

And save the a user as:

user = User()
user.save()

It reports Session has no attribute 'save'

I looked into the code of elixir, found it invokes sqlalchemy.org.session.Session#save(), but there is no save() method there.

So, is elixir outdated, and we should not use it any more?

Ben
  • 51,770
  • 36
  • 127
  • 149
Freewind
  • 193,756
  • 157
  • 432
  • 708

2 Answers2

1

I am using the same versions of SQLAlchemy and Elixir so it is definitely compatible. Not sure what you are trying to do with the above code.

dotnix
  • 848
  • 9
  • 13
  • How do you save an entity? `entity.save()` will throw exception, and `session.add(entity)` will also throw exception. – Freewind Sep 18 '10 at 15:38
1

Remember to call setup_all(True) before doing anything with session or query. This will do the necessary ORM mappings for the session and the query to work properly.

ychaouche
  • 4,922
  • 2
  • 44
  • 52