Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

I think I've seen this ORM somewhere before...

Ticket #42 (defect)

Opened 7 years ago

Last modified 6 years ago

Shelve issues and some community improvements

Status: closed (fixed)

Reported by: Lethalman Assigned to: fumanchu
Priority: major Milestone:
Component: Docs Keywords:
Cc: Estimate (total hours): 1

Hello, first of all very nice project, i'm going to left sqlalchemy for one of my projects to use Dejavu.

1

I've this simple config:

[Shelve]
Class: dejavu.storage.storeshelve.StorageManagerShelve
Path: dejavudb

And this code:

from dejavu import *

class Test(Unit):
    Field = UnitProperty(unicode)

arena = Arena()
arena.load('dejavu.conf')
arena.register_all(globals())
box1, box2 = arena.new_sandbox(), arena.new_sandbox()
print box1.recall(Test)
p1, p2 = Test(Field='Box1'), Test(Field='Box2')
box1.memorize(p1)
box2.memorize(p2)
box1.flush_all()
box2.flush_all()

I debbugged a bit and everything seems to work, but maybe the problem is saving the shelf. This is my first code using Dejavu, maybe (i'll hope for sure) i'm wrong.

2

Here is a typo in the shelve storage... use flag 'c' instead of 'w' when opening the file.

Change History

02/21/06 00:05:55: Modified by fumanchu

  • status changed from new to assigned.
  • estimate set to 1.
  • component changed from Storage to Docs.

Actually, that's all by design ;) You need to call arena.create_storage (which creates storage for each unit, in the case of shelve, it creates the file). This must be done before you call recall().

The easiest way to do that for all of your registered classes is to call:

Schema(arena).assert_storage()

But it needs to be documented, better, obviously ;)

02/21/06 15:20:28: Modified by Lethalman

Yes i encountered this problem using SQLite because of an exception, here there's no exceptions, i think there should be a raise, don't you?

02/22/06 08:07:04: Modified by fumanchu

I'm not sure what you mean by that...?

02/22/06 14:46:36: Modified by Lethalman

If you use shelve storage without being created you get no exceptions while you get it using the SQLite store. That's why i thought storages were created automatically, because of no exceptions ;)

03/03/06 07:37:25: Modified by fumanchu

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in [178].

12/17/06 03:20:35: Modified by fumanchu

  • description changed.