[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: drug databases



On Sun, Jan 20, 2008 at 10:28:07PM +0100, paul van den berg wrote:

> >> Does your script turn the data into SQL statements ? That
> >> would be *most* useful, much more than a mysql database as
> >> such.
> >
> > Sounds very reasonable.  I could imagine scripts
> >
> >    create_act-ddd_drug_db
> >    update_act-ddd_drug_db
> >
> > featuring a command line options for instance -m for MySQL and
> > -p for PostgreSQL.
> >
> > Our task in Debian-Med would be to turn this script into an
> > easily installable Debian package.
> 
> It is easy to convert $dbh->do(insert ..) to print(insert ..),
> but it is not so easy to write fully portable sql.
> In my script I use
>  create table if not exists ..
>  insert ignore into ..
> and these constructs are mysql-specific.

I suggest you provide two options:

--data-only

	output INSERT statements only, no table creation
	don't use MYSQLisms in INSERT INTO queries

--schema-only

	output table defs only, can be mysql-specific

If none of those options is given, then output schema and
data for mysql (IOW, just like now).

I would (for PostgreSQL) then do:

- first run with --schema-only
- adjust tables for PG
- import tables by hand into PG
- second run with --data-only
- import data into PG by hand

> I have tried (with postgresql and sqlite3) to rewrite it in
> portable sql, but that is not yet ready. Maybe someone else can
> give it a try.
> I have put my scripts online at
> http://home.orange.nl/pbvandenberg/medicindata.html
Will have a look.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Reply to: