Any way you can you test it with passing in parameters mdbArgs to use
a non-local mysql instance? If you have that capability, that would be
great.

On May 25, 6:19 am, Namshin Kim <n...@rna.kr> wrote:
> Hmm... I tested again and it worked. And, new lines are successfully added
> to the mysql table.
>
> [deepr...@s47 ~]$ python>>> from pygr import metabase
> >>> mdb = metabase.MetabaseList()
> >>> mdb = metabase.MySQLMetabase('test.pygr', mdb, createLayer='test')
> >>> mdb = metabase.MetabaseList('mysql:test.pygr')
> >>> mdb.dir()
>
> ['0version', 'PYGRLAYERNAME']>>> from pygr.seqdb import SequenceFileDB
> >>> g = SequenceFileDB('hg18')
> >>> g.__doc__ = 'hg18'
> >>> mdb.add_resource("Bio.Seq.Genome.HUMAN.hg18", g)
> >>> mdb.commit()
> >>> mdb.dir()
>
> ['0root', '0version', 'Bio.Seq.Genome.HUMAN.hg18', 'PYGRLAYERNAME']
>
>
>
> [deepr...@s47 ~]$ python>>> from pygr import metabase
> >>> mdb = metabase.MetabaseList('mysql:test.pygr')
> >>> mdb.dir()
>
> ['0root', '0version', 'Bio.Seq.Genome.HUMAN.hg18', 'PYGRLAYERNAME']
>
>
>
> On Tue, May 25, 2010 at 10:53 AM, Kenny Daily <kmda...@gmail.com> wrote:
> > OK! I got this to work. But when I try to add something, I get no
> > warnings, errors, or exceptions, but it doesn't add any rows to the
> > tables. Then when I set up the MetabaseList again (leaving the
> > interpreter), the resource I've added is gone.
>
> > from pygr import metabase
> > from pygr import seqdb
>
> > mdb = metabase.MetabaseList()
> > rdb = metabase.MySQLMetabase(tablename="worldbase.worldbaseindex
> > my.host.edu user pass", mdb=mdb, createLayer="baldig",
> > host="my.host.edu", port=5000)
>
> > ## created this already, tables exist
> > mdb = metabase.MetabaseList("mysql:worldbase.worldbaseindex",
> > mdbArgs=dict(host="my.host.edu", db="worldbase", port=5000,
> > user="user", passwd="pass"))
>
> > g = seqdb.SequenceFileDB("/path/to/sacCer2.fa")
> > g.__doc__ = "Yeast genome"
>
> > ## no errors!
> > mdb.add_resource("Bio.Seq.Genome.YEAST.sacCer2", g)
> > mdb.commit()
> > mdb.dir()
> > Out[30]: ['0root', '0version', 'Bio.Seq.Genome.YEAST.sacCer2',
> > 'PYGRLAYERNAME']
>
> > Then exit the shell....
>
> > from pygr import metabase
>
> > ## created this already, tables exist
> > mdb = metabase.MetabaseList("mysql:worldbase.worldbaseindex",
> > mdbArgs=dict(host="my.host.edu", db="worldbase", port=5000,
> > user="user", passwd="pass"))
> > mdb.dir()
> > Out[3]: ['0version', 'PYGRLAYERNAME']
>
> > Database contents:
> > mysql> select * from worldbaseindex_schema;
> > Empty set (0.00 sec)
>
> > mysql> select * from worldbaseindex;
> > +---------------+----------+-----------+------+---------------------
> > +-------------+---------------+-----------+---------+
> > | pygr_id       | location | docstring | user | creation_time       |
> > pickle_size | security_code | info_blob | objdata |
> > +---------------+----------+-----------+------+---------------------
> > +-------------+---------------+-----------+---------+
> > | 0version      | 0.1.0    | NULL      | NULL | NULL
> > |        NULL |          NULL | NULL      | a       |
> > | PYGRLAYERNAME | baldig   | NULL      | NULL | 2010-05-24 17:14:21
> > |        NULL |          NULL | NULL      | a       |
> > +---------------+----------+-----------+------+---------------------
> > +-------------+---------------+-----------+---------+
> > 2 rows in set (0.01 sec)
>
> > Kenny
>
> > On May 24, 5:01 pm, Namshin Kim <n...@rna.kr> wrote:
> > > I am not sure whether this is correct usage because many things changed
> > > since I used MySQL as metabase.
>
> > > >>> import os
> > > >>> from pygr import metabase
> > > >>> mdb = metabase.MetabaseList() # open dummy metabase
> > > >>> mdb = metabase.MySQLMetabase('test.pygr', mdb, createLayer='test')
>
> > /data1/deepreds/projects/Pygr_Project/pygr/build/lib.linux-x86_64-2.5/pygr/
> > metabase.py:333:
> > > Warning: Unknown table 'pygr'
> > >   self.cursor.execute('drop table if exists %s' % self.tablename)
>
> > /data1/deepreds/projects/Pygr_Project/pygr/build/lib.linux-x86_64-2.5/pygr/
> > metabase.py:343:
> > > Warning: Unknown table 'pygr_schema'
> > >   self.cursor.execute('drop table if exists %s' % schemaTable)
>
> > > # database created.
> > > mysql> desc pygr;
> > > +---------------+--------------+------+-----+---------+-------+
> > > | Field         | Type         | Null | Key | Default | Extra |
> > > +---------------+--------------+------+-----+---------+-------+
> > > | pygr_id       | varchar(255) | NO   | PRI | NULL    |       |
> > > | location      | varchar(255) | NO   | PRI | NULL    |       |
> > > | docstring     | varchar(255) | YES  |     | NULL    |       |
> > > | user          | varchar(255) | YES  |     | NULL    |       |
> > > | creation_time | datetime     | YES  |     | NULL    |       |
> > > | pickle_size   | int(11)      | YES  |     | NULL    |       |
> > > | security_code | bigint(20)   | YES  |     | NULL    |       |
> > > | info_blob     | text         | YES  |     | NULL    |       |
> > > | objdata       | text         | NO   |     | NULL    |       |
> > > +---------------+--------------+------+-----+---------+-------+
> > > 9 rows in set (0.00 sec)
>
> > > mysql> desc pygr_schema;
> > > +-----------+--------------+------+-----+---------+-------+
> > > | Field     | Type         | Null | Key | Default | Extra |
> > > +-----------+--------------+------+-----+---------+-------+
> > > | source_id | varchar(255) | NO   | MUL | NULL    |       |
> > > | target_id | varchar(255) | YES  |     | NULL    |       |
> > > | edge_id   | varchar(255) | YES  |     | NULL    |       |
> > > +-----------+--------------+------+-----+---------+-------+
> > > 3 rows in set (0.00 sec)
>
> > > >>> mdb = metabase.MetabaseList('mysql:test.pygr') # open THAT metabase
> > > again for re-use
> > > >>> mdb.dir()
>
> > > ['0version', 'PYGRLAYERNAME']
>
> > > On Tue, May 25, 2010 at 8:49 AM, Kenny Daily <kmda...@gmail.com> wrote:
> > > > But what is the 'mdb' object in this line:
>
> > > > rdb = metabase.MySQLMetabase('pygrdata.index', mdb,
> > > > createLayer='leelab')
>
> > > > Since you are saying to create something of the same name only after I
> > > > create this! What am I missing?
>
> > > > Kenny
>
> > > > On May 23, 4:21 am, Namshin Kim <n...@rna.kr> wrote:
> > > > > rdb = metabase.MySQLMetabase('pygrdata.index', mdb,
> > createLayer='leelab')
>
> > > > > I guess you are talking about one-liner above. 'pygrdata' is a
> > database
> > > > name
> > > > > and 'index' is a table name. And 'leelab' is a layer name. Thus, you
> > > > should
> > > > > be able to create table on pygrdata database.
>
> > > > > After you create metabase.MySQLMetabase, you can access using usual
> > > > > metabase.
>
> > > > > mdb = metabase.MetabaseList('mysql:pygrdata.index')
>
> > > > > Or you can set WORLDBASEPATH to be mysql:pygrdata.index
>
> > > > > On Fri, May 21, 2010 at 9:36 AM, Kenny Daily <kmda...@gmail.com>
> > wrote:
> > > > > > Is there a mysql metabase example somewhere? I only saw the
> > one-liner
> > > > > > in the module documentation.
>
> > > > > > The example in the module documentation shows I need to create a
> > > > > > metabase.Metabase. But looking at this code, it seems that this
> > calls
> > > > > > metabase.MySQLMetabase if something on the worldbase path is a
> > mysql
> > > > > > database! I'm also not sure what to use as the resourceCache.
> > Finally,
> > > > > > how would I reconnect to this? Do I need a script such as what is
> > in
> > > > > > the __init__.py?
>
> > > > > > Also, the database server uses a non-standard port - can I pass
> > this
> > > > > > through kwargs so it gets to the mysql_connect?
>
> > > > > > Thanks!
>
> > > > > > Kenny
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "pygr-dev" group.
> > > > > > To post to this group, send email to pygr-...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > pygr-dev+unsubscr...@googlegroups.com<pygr-dev%2bunsubscr...@googlegroups.com>
> > <pygr-dev%2bunsubscr...@googlegroups.c om>
> > > > <pygr-dev%2bunsubscr...@googlegroups.com<pygr-dev%252bunsubscr...@googlegroups.com>
> > <pygr-dev%252bunsubscr...@googlegro ups.com>
>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/pygr-dev?hl=en.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "pygr-dev" group.
> > > > > To post to this group, send email to pygr-...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > pygr-dev+unsubscr...@googlegroups.com<pygr-dev%2bunsubscr...@googlegroups.com>
> > <pygr-dev%2bunsubscr...@googlegroups.c om>
> > > > .
> > > > > For more options, visit this group athttp://
> > > > groups.google.com/group/pygr-dev?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "pygr-dev" group.
> > > > To post to this group, send email to pygr-...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > pygr-dev+unsubscr...@googlegroups.com<pygr-dev%2bunsubscr...@googlegroups.com>
> > <pygr-dev%2bunsubscr...@googlegroups.c om>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/pygr-dev?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "pygr-dev" group.
> > > To post to this group, send email to pygr-...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > pygr-dev+unsubscr...@googlegroups.com<pygr-dev%2bunsubscr...@googlegroups.com>
> > .
> > > For more options, visit this group athttp://
> > groups.google.com/group/pygr-dev?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pygr-dev" group.
> > To post to this group, send email to pygr-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > pygr-dev+unsubscr...@googlegroups.com<pygr-dev%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/pygr-dev?hl=en.
>
> --
> You received this message ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"pygr-dev" group.
To post to this group, send email to pygr-...@googlegroups.com.
To unsubscribe from this group, send email to 
pygr-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pygr-dev?hl=en.

Reply via email to