Ok,

I used a different query found on 
http://stackoverflow.com/questions/8287758/sqlite-data-dictionary-tables-and-columns

@service.xmlrpc
@service.run
def schema(table=None):
     "returns the table schema or database schema when argument is None"
     tables = db.executesql("SELECT name FROM sqlite_master WHERE 
type='table'")
     return tables



http://127.0.0.1:8000/TAMOTO_DEV/default/call/xml/schema at least returned 
an ugly list of tables but:

@service.xmlrpc
@service.run
def schema(table=None):
     "returns the table schema or database schema when argument is None"
     tables = db.executesql("SELECT name FROM sqlite_master WHERE 
type='table'")
     for table_name in tables
         table_info = db.executesql("pragma table_info(" + table_name + ")")
     return table_info



wont even compile. Something wrong with the for loop. I think the contents 
of 
tables

is not formatted properly.

Can anyone give me a little hint or point me in the right direction?
Thank you,
Bill

On Wednesday, May 2, 2012 4:25:41 PM UTC-5, Bill Thayer wrote:
>
> I am writing the database definition for my documentation. Is there not a 
> way to use xmlrpc to export the schema? Here was my first attempt:
>
> @service.xmlrpc
> def schema(table=None):
>      "returns the table schema or database schema when argument is None"
>      return db.executesql('.schema')
>
>
>
> The .schema command came from 
> http://stackoverflow.com/questions/604939/how-can-i-get-the-list-of-a-columns-in-a-table-for-a-sqlite-database
>
> Then I called: http://127.0.0.1:8000/TAMOTO_DEV/default/call/xml/schema
>
> but the browser returned "Object does not exist"
>
> So I tried debugging by first confirming @service.xmlrpc works by using 
> the example from the book:
> @service.run
> @service.xmlrpc
> def concat(a,b):
>     return a+b
> But the call 
> http://127.0.0.1:8000/TAMOTO_DEV/default/call/xml/concat?a=hello&b=world
>
> returned:
> XML Parsing Error: syntax error
> Location: 
> http://127.0.0.1:8000/TAMOTO_DEV/default/call/xml/concat?a=hello&b=world
> Line Number 1, Column 39:<?xml version="1.0" encoding="UTF-8"?>helloworld
>
> ---------------------------------------------------------------------------------------------------^
>
> I expected:
>
> <document>
>    <result>helloworld</result>
> </document>
>
> Like in the book.
>
> Thanks for your insight.
>
> Regards,
> Bill
>
>
>
>

Reply via email to