On Fri, Oct 4, 2013 at 1:45 AM, Marc'h <
mhoe...@gmail.com> wrote:
> Thus, I'd like to know if there is any means to by-pass the automatic
> persistence mechanism when using collection attributes which are foreign-key
> based.
the ORM is a mapping to an SQL database, by definition that means
persistent storage. while you can create a model object and not
save() it, relationships are based on the record's primary key, which
is assigned (by the RDBMS) only when save()d.
so, no; there's no "direct" way to avoid persistence and use
relationships. in fact, any kind of query works only via the
database.
memory-only SQL tables would do the trick, but most implementations
use them only for connection-private tables. after a cursory re-read
of SQLite docs, I don't see any way to create a shared memory table,
the "file::memory:?cache=shared" URI only means that it is shared
between different connections on the same process
a not-so-nice option could be to specify a RAM disk (or tmpfs)
location for your database. it would sitll be file-based, and
persistant over different invocations, but faster and less durable
than a real disk file.
if not, then i think you should avoid the ORM and use a shared memory
storage; either memcached, Redis, uWSGI cache, or something similar.
it's not relational, but you should be able to create the needed
queries without too much trouble.
--
Javier