If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    spametki  8 years ago

    Note: an updated version of this code was included in trunk as an experimental feature.

     

    The DAL commands are

    db.as_dict(<flat=False, sanitize=True>)
    table.as_dict(<flat=False, sanitize=True>)
    field.as_dict(<flat=False, sanitize=True>)
    
    db.as_xml(<sanitize=True>)
    table.as_xml(<sanitize=True>)
    field.as_xml(<sanitize=True>)
    
    db.as_json(<sanitize=True>)
    table.as_json(<sanitize=True>)
    field.as_json(<sanitize=True>)
    

Commented on:

This code outputs the db structure as xml (or a dict object). The purpose of this snippet is add support for javascript frameworks like angular.js This is a prototype for adding the db scheme export built-in feature to web2py. Note that the code actually works without implementing within the DAL modules (i.e. It could be used as plugin or app model code).

Hosting graciously provided by:
Python Anywhere