If you perform a getas with no properties defined, the view's structure will be empty. Define even one [valid] property in the view, and you'll get all the properties when you call structure . If the property wasn't valid, of course, you'll end up defining it. Oops.>>> import metakit
>>> db = metakit.storage('weblog.data',0)
>>> vw = db.getas('posts')
>>> len(vw)
0
>>> vw.structure()
[]
>>> vw = db.getas('posts[id:S]')
>>> len(vw)
24
>>> vw.structure()
[Property('S', 'id'),
Property('S', 'title'),
Property('S', 'link'),
Property('S', 'source'),
Property('S', 'sourceurl'),
Property('S', 'text'),
Property('S', 'rendered'),
Property('I', 'onhome'),
Property('I', 'structured'),
Property('S', 'pubdate'),
Property('F', 'pubtime'),
Property('V', 'categories')]
>>> I'm thinking PyDS might need some kind of lightweight schema manager to mediate between tools and their databases. My main driver for this is so that tools can safely access each others' data. Specifically, so that I can write a RadioMigrationTool. It'll want to add categories, add posts, and maintian its own preferences so you can do things like suck the data down again if necessary. Another concern is adding properties. If I want to keep track of Radio's post ID, so I can keep the permalinks intact, how would I do that? There's a lot to ponder, here. |