
{"id":141,"date":"2009-02-20T21:34:04","date_gmt":"2009-02-21T02:34:04","guid":{"rendered":"http:\/\/www.ikriv.com\/blog\/?p=141"},"modified":"2009-02-20T21:34:04","modified_gmt":"2009-02-21T02:34:04","slug":"an-orm-layer-in-roundup","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=141","title":{"rendered":"An ORM Layer in Roundup"},"content":{"rendered":"<p><a href=\"http:\/\/roundup.sourceforge.net\/\">Roundup<\/a>, an bug\/issue tracker has a nice approach to ORM. It is written in Python, they have a file called <code>schema.py<\/code> where you define your database schema in Python. It then automatically generates the tables in MySQL, PostgreSql, Sqlite, or AnyDbm (you get to choose), and <b>keeps them in sync with your schema<\/b> when you change it!<br \/>\n<!--more--><br \/>\nI thought it was a standard feature of Python, but it appears to be a unique product of Roundup developers. They have a database-like structure called Hyper DB (I am not sure whether it is all in-memory or not), and a number of<br \/>\n&#8220;back-ends&#8221; that can map Hyper DB to a relational database (or a DBM).<\/p>\n<p>One nice feature is that the database schema is stored as string in the Schema table. This string is in fact a Python dictionary, something like<\/p>\n<pre>{'tables':\n  {'impact':\n    ('name',\n       [ ('name', '<roundup.hyperdb.String>'),\n         ('order', '<roundup.hyperdb.Number>') ]),\n\n    'svn_repo':\n      ('name',\n        [ ('path', '<roundup.hyperdb.String>'),\n          ('viewcvs_url', '<roundup.hyperdb.String>'),\n          ('host', '<roundup.hyperdb.String>'),\n          ('name', '<roundup.hyperdb.String>') ]),\n...\n}<\/pre>\n<p>Then they just do eval(schema) to get a Python data structure out of it and compare with the current schema. Quite clever, albeit fairly restricted in some places to Roundup-specific use.<\/p>\n<p>Roundup itself, by the way, did not turn out to be that great a bug tracker: it is very flexible, but tweaking it (e.g. adding a field) requires too many changes in too many places, and it uses technologies that I am not that familiar with. such as TAL template language. But I am very impressed with the database capabilities. Will investigate it further.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Roundup, an bug\/issue tracker has a nice approach to ORM. It is written in Python, they have a file called schema.py where you define your database schema in Python. It <a href=\"https:\/\/ikriv.com\/blog\/?p=141\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[14,15],"tags":[],"class_list":["entry","author-ikriv","has-more-link","post-141","post","type-post","status-publish","format-standard","category-db","category-webdev"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}