Thanks for this!  I'm just getting back to it now...

(For those that don't remember the original message, I want to dump my whole database as text or yaml or json or whatever....basically I'm writing my own mysqldump).

So you've given me step one and it works well.  Thank you.

tables = connection.queryAll('show tables')
for table in tables:
    print "\t", table[0]
Now I know step three is something like this:
        recdict = record.sqlmeta.asDict()

But I can't figure out how to go from step one to step three.  Given the table name as a string, how do I convert it to an object where sqlobject goes and creates an object based on the info in the database?

Thanks again!

On Tue, Mar 25, 2008 at 6:00 PM, Oleg Broytmann <phd@phd.pp.ru> wrote:
On Tue, Mar 25, 2008 at 05:24:10PM -0300, Sam's Lists wrote:
> My first silly question is how can I, using  sqlobject, find the names of
> all the tables in my database.
> (A related question...can I find the names of all the databases as well?)

  There is no way in SQLObject. SO assumes you know your database and
tables. You can draw the scheme for a table from DB but you have to know
the table's name in advance.

  Of course you can add such feature to SO. The query in MySQL is
SHOW TABLES, in SQLite it is
SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;
and in Postgres it is something like SELECT c.relname FROM pg_class c,
pg_type t WHERE c.reltype = t.oid AND t.typname = 'table';

    Oleg Broytmann            http://phd.pp.ru/            phd@phd.pp.ru
          Programmers don't die, they just GOSUB without RETURN.

This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
sqlobject-discuss mailing list