[BioSQL-l] [Newbie] find_by_query() usage ?

Hilmar Lapp hlapp@gnf.org
Mon, 6 Jan 2003 10:20:02 -0800


I'm a sorry about the lack of documentation about this feature. The best place to look at currently is the test file in t/query.t. It gives quite a number of examples (which even work if the tests pass :) 

Generally speaking you're right. You need to populate your query object with something meaningful. From your example it's not clear what you actually wanted to query for. Let me know what and I'll try to answer how to populate the query object.

	-hilmar

> -----Original Message-----
> From: Mark Hoebeke [mailto:mhoebeke@jouy.inra.fr]
> Sent: Monday, January 06, 2003 3:03 AM
> To: biosql-l@open-bio.org
> Subject: [BioSQL-l] [Newbie] find_by_query() usage ?
> 
> 
> Hi all,
> 
> I just managed to load some whole genomes into my BioSQL compliant
> database, but now I run into troubles when trying to retrieve them
> with the following script Perl script:
> 
> <snip>
> my $dbadap= Bio::DB::BioDB->new(
> 				-database => 'biosql',
> 				-dbname => $dbname,
> 				-user => $dbuser,
> 				-host => $dbhost,
> 				-driver => $dbdriver);
> 
> my $objadap=$dbadap->get_object_adaptor("Bio::SeqI");
> 
> my $query=Bio::DB::Query::BioQuery->new(); 
> 
> my $result=$objadap->find_by_query();
> 
> foreach my $obj ($result->each_Object()) {
>     print "Id : $obj->display_id\n";
> }
> </snip>
> 
> This script fails in the find_bu_query() method call, with an error
> message like this (topmost exeception) :
> 	
> DBD::Pg::st execute failed: ERROR:  parser: parse error at or 
> near "." at character 8 at 
> /usr/lib/perl5/site_perl/5.8.0/Bio/DB/BioSQL/BasePersistenceAd
> aptor.pm line 1083.
> 
> A quick investigation traced to problem to be in the SQL generation
> code as the query string is as follows :
> 
>      SELECT .bioentry_id, .display_id, .identifier, .accession,
>      .description, .entry_version, .biodatabase_id, .taxon_id FROM
> 
> Obvisously, the table name(s) is (are) missing in the query string.
> 
> I guess the creation of the Bio::DB::Query::BioQuery instance may be
> wrong. I read through the POD files, and the sample scripts to find an
> example based on the find_by_query() method but found none.
> 
> Thanks for any pointers showing how to use the find_by_query method.
> 
> Mark
> 
> P.S. : sorry if this message is more related to BioPerl than 
> to BioSQL...
> 
> -- 
> mhoebeke@jouy.inra.fr                          _/      _/  
> _/_/_/    _/_/_/
> Tel : (+33) 01 34 65 28 85                    _/_/  _/_/    
> _/    _/       
> Fax : (+33) 01 34 65 29 01                   _/  _/  _/    _/ 
>    _/  _/_/  
> INRA - Unité MIG - Domaine de Vilvert       _/      _/    _/  
>   _/    _/      
> F - 78352 Jouy-en-Josas CEDEX              _/      _/  _/_/_/ 
>    _/_/_/       
> _______________________________________________
> BioSQL-l mailing list
> BioSQL-l@open-bio.org
> http://open-bio.org/mailman/listinfo/biosql-l
>