1

I had been using ActiveRecord previously and it allowed to load all associations of an object using an optional :include argument to its dynamic finders. I have recently started using Elixir for a python project and am unable to find any documentation that'd suggest if it's possible to do the same.

Ben
  • 51,770
  • 36
  • 127
  • 149
Chandranshu
  • 3,669
  • 3
  • 20
  • 37

1 Answers1

1

Using plain SQLAlchemy (without Elixir): http://www.sqlalchemy.org/docs/orm/loading.html

I assume you can configure the loading strategies using Elixir as well, but I have never used it.

EDIT 1:

According to the Elixir documentation, options to the relationship constructs (for instance ManyToOne) can include options that are passed directly to the SQLAlchemy relation (relationship if version >= 0.6) function. That means you can specify the lazy option to control the loading for associated objects.

I assume that Elixir's query method is a thin wrapper around SQLAlchemy's. In that case, you can also control lazy/eager loading for individual queries. See the documentation.

EDIT 2:

Have you considered using sqlalchemy.ext.declarative instead of Elixir?

codeape
  • 97,830
  • 24
  • 159
  • 188
  • Your first suggestion to use the lazy option to control the loading worked for me. I'll look into the second one as well. – Chandranshu Jan 24 '11 at 09:43