[Grok-dev] Re: STORM howto

Sebastian Ware sebastian at urbantalk.se
Fri Mar 14 07:20:32 EDT 2008


The only stuff I had to do outside python was:

1 create the database

   sqlite3 /bla/bla/movements.db

2 create the table

   CREATE TABLE Movements (id INTEGER PRIMARY KEY AUTOINCREMENT,  
transactionId VARCHAR(50), containerId VARCHAR(50), nodeId  
VARCHAR(50), resourceId VARCHAR(50), qty FLOAT, conversion FLOAT,  
variantId VARCHAR(50));

Then I had to define the mapping types in the object:

     __storm_table__ = "Movements"  # This is the corresponding table  
in our DB

     id = locals.Int(primary = True)
     _transactionId = locals.Chars(name="transactionId")
     containerId = locals.Unicode()
     nodeId = locals.Unicode()
     resourceId = locals.Unicode()
     qty = locals.Float()
     conversion = locals.Float()
     variantId = locals.Unicode()

It wasn't too bad in my case, but it would be nice if it used the  
definitions above to create the database. Automatic generation from  
the schema definition would be cool, but then again, just not too  
automatic... oops there goes the data...

Mvh Sebastian

14 mar 2008 kl. 12.02 skrev Martijn Faassen:

>
> The other point that bothers me about Storm is that they do not have  
> a database schema abstraction in Python. It's not possible to  
> generate a RDB schema from Python. They do not generate "create  
> table" statements at all. Although they're not absolutely against  
> adding such a feature, instead, they prefer and recommend people  
> maintain their RDB the RDB way. While I agree that for many projects  
> this is the right approach to take, I also think that the lack of  
> such can seriously hinder agility in smaller/starting projects  
> (where you just want to get going) and "demo-ability". In addition,  
> I think SQLAlchemy allows introspection of existing databases, which  
> allows for the generation of cool tools as well. Again a schema  
> abstraction is helpful to support this kind of feature.



More information about the Grok-dev mailing list