[MonetDB-users] schema reconstruction

Hi, I'm trying to build a driver for monetdb for sqlalchemy (a python ORM layer). One of the things I need to do for that is provide a way to reconstruct the (some of) database schema on the fly. It seems to be easily possible to reconstruct most of the table definition from the 'table' and 'columns' tables, but how do I retrieve key contraints? Specifically, given this table definition: create table test ( id integer primairy key, name varchar(10) ) , I get some data in the keycolums table, but don't know how to relate that to the tables and colums tables. I also need something simular for foreign keys, but haven't looked into that yet. Ronald P.S. I'm using the head of the CVS trunk.

Hi Ronald, Both the JDBC and ODBC code are able to produce this data. Have you looked into that code at the SQL queries? For JDBC you find them in sql/src/jdbc/nl/cwi/monetdb/jdbc/DatabaseMetaData.java. Regards On 19-09-2006 14:13:45 +0200, Ronald Oussoren wrote:
Hi,
I'm trying to build a driver for monetdb for sqlalchemy (a python ORM layer). One of the things I need to do for that is provide a way to reconstruct the (some of) database schema on the fly.
It seems to be easily possible to reconstruct most of the table definition from the 'table' and 'columns' tables, but how do I retrieve key contraints?
Specifically, given this table definition:
create table test ( id integer primairy key, name varchar(10) )
, I get some data in the keycolums table, but don't know how to relate that to the tables and colums tables.
I also need something simular for foreign keys, but haven't looked into that yet.
Ronald
P.S. I'm using the head of the CVS trunk.
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users

In addition, look at the source of MapiClient, in particular the file MonetDB/src/mapi/clients/C/dump.c in the current CVS (or MapiClient.mx in the latest distribution) which retrieves the constraints to create a dump file of the database. On 2006-09-19 14:26, Fabian Groffen wrote:
Hi Ronald,
Both the JDBC and ODBC code are able to produce this data. Have you looked into that code at the SQL queries? For JDBC you find them in sql/src/jdbc/nl/cwi/monetdb/jdbc/DatabaseMetaData.java.
Regards
On 19-09-2006 14:13:45 +0200, Ronald Oussoren wrote:
Hi,
I'm trying to build a driver for monetdb for sqlalchemy (a python ORM layer). One of the things I need to do for that is provide a way to reconstruct the (some of) database schema on the fly.
It seems to be easily possible to reconstruct most of the table definition from the 'table' and 'columns' tables, but how do I retrieve key contraints?
Specifically, given this table definition:
create table test ( id integer primairy key, name varchar(10) )
, I get some data in the keycolums table, but don't know how to relate that to the tables and colums tables.
I also need something simular for foreign keys, but haven't looked into that yet.
Ronald
P.S. I'm using the head of the CVS trunk.
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender

Ronald Oussoren wrote:
I'm trying to build a driver for monetdb for sqlalchemy (a python ORM layer).
Just a random cheerleading post, but cool! Such a thing would be very nice to have. I myself have been watching pathfinder (XQuery) development for Monet and hopefully at some point will get around to developing a Python layer for that, probably using lxml. Regards, Martijn
participants (4)
-
Fabian Groffen
-
Martijn Faassen
-
Ronald Oussoren
-
Sjoerd Mullender