[YLUG] Parsable Rack Diagrams

Arthur Clune arthur at clune.org
Tue Aug 7 21:09:14 BST 2007


On 7 Aug 2007, at 20:47, Robert Hulme wrote:

> You could use an ORM like ActiveRecord or Nitro/Og in Ruby to act as a
> store for all your objects with an 'in memory' sqlite backend. Then
> whenever the app finishes what it's doing (I imagine you just call it
> from the command line now and then) you dump all the objects to disk
> using YAML or JSON or something.
>
> When the app starts it would load all the objects from disk and
> recreate them in the in memory sqlite DB.

I'm probably missing something here, but if you're doing that, why
not just use the ORM with sqlite and miss out all the faffing with
dumping/creating objects? After all, isn't that what the orm is
for?

If diffable files are essential, then dump the sql to a format
that diffs easily on a per rack basis, but keep the master data
in sql. In a sort of python orm syntax:

if user_wants_files:
	chdir('some/base/dir')
	foreach rack in Racks.select():
		rack.output_as_file(rack.rackname)

Then if you really want to end all the wars, implement
rack.output_as_xml(), _as_yaml() etc

Arthur




More information about the York mailing list