[BioPython] BioSql: Checking if exists a database.
Cristian S. Rocha
crocha at dc.uba.ar
Mon May 17 09:28:57 EDT 2004
Hi,
I need to check if exists a database before to create it. I write the
following but it doesn't work.
"""
server = BioSeqDatabase.open_database(driver='MySQLdb', user='bio',
passwd='secret', host='localhost', db='bio')
if database in server:
db = server[database]
else:
db = server.new_database(database)
"""
The traceback output is:
"""
File "BioTools.py", line 160, in ?
SequenceStoreFile(open('example.fasta'), 'estC', 'fasta')
File "BioTools.py", line 103, in SequenceStoreFile
if database in server:
File
"/home/crocha/Tmp/biopython/biopython/build/lib.linux-i686-2.2/BioSQL/BioSeqDatabase.py", line 78, in __getitem__
return BioSeqDatabase(self.adaptor, name)
File
"/home/crocha/Tmp/biopython/biopython/build/lib.linux-i686-2.2/BioSQL/BioSeqDatabase.py", line 308, in __init__
self.dbid = self.adaptor.fetch_dbid_by_dbname(name)
File
"/home/crocha/Tmp/biopython/biopython/build/lib.linux-i686-2.2/BioSQL/BioSeqDatabase.py", line 168, in fetch_dbid_by_dbname
raise KeyError("Cannot find biodatabase with name %r" % dbname)
"""
I feel it's not implemented these feature or it's not the best way to
check it. If it's the last case, How can I do it?
thxs,
Cristian.
--
Lic. Cristian S. Rocha.
<crocha at dc.uba.ar>
Departamento de Computacin. FCEyN. UBA.
Pabellon I. Cuarto 9.
Ciudad Universitaria.
(1428) Buenos Aires. Argentina.
Tel: +54-11-4576-3390/96 int 714
Tel/Fax: +54-11-4576-3359
Cel: 15-5-607-9192
More information about the BioPython
mailing list