On 4/4/15 12:14 PM, Mike Bayer wrote:
>
>
> On 4/4/15 11:27 AM, biohege...@gmail.com wrote:
>> Hi,
>>
>> I get a strange error when querying a many-to-many relationship
>> (Protein - Omim / protein - omim).
>> sqlalchemy 0.9.9
>>
>> o=Omim.query.filter(Omim.acc=="157140").one() # this is OK
>> o.proteins # this gives an error
>>
>> 2015-04-04 17:16:09,984 INFO sqlalchemy.engine.base.Engine SELECT
>> protein.id AS protein_id, protein.acc AS protein_acc,
>> protein.entry_name AS protein_entry_name, protein.gene_name AS
>> protein_gene_name, protein.is_human AS protein_is_human,
>> protein.is_membrane AS protein_is_membrane, protein.is_reviewed AS
>> protein_is_reviewed, protein.sprot_str AS protein_sprot_str
>> FROM protein, omim_assoc
>> WHERE %s = omim_assoc.omim_id AND protein.id = omim_assoc.protein_id
>> 2015-04-04 17:16:09,985 INFO sqlalchemy.engine.base.Engine (16083L,)
>> Traceback (most recent call last):
>> [skipped]
>>   File
>> "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.9.9-py2.7-linux-x86_64.egg/sqlalchemy/orm/strategies.py",
>> line 169, in fetch_col
>>     dict_[key] = row[col]
>> ValueError: int_to_boolean only accepts None, 0 or 1
>>
>> ----
>> However, when querying this in mysql client:
>> SELECT protein.id AS protein_id FROM protein, omim_assoc WHERE 16083
>> = omim_assoc.omim_id AND protein.id = omim_assoc.protein_id;
>> No problem, the protein is found.
>>
>> Moreover, if I query Omim with a different ac, it works.
>>
>> ----
>> I have no idea how to debug...
>
> you are using the Boolean() type in your table metadata for the column
> called "acc" and you need to change it to be the type "Integer()";
> additionally, in your query, you need to refer to this value as an
> integer, 'Omin.acc==157140', without quotes around the numeric value.

correction, you are using the Boolean() type somewhere in your model to
a column being referred to by the omim_assoc.omin_id column, this needs
to be Integer().


>
>
>
>>
>> Thanks for your help in advance,
>> Tamas
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to sqlalchemy+unsubscr...@googlegroups.com
>> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
>> To post to this group, send email to sqlalchemy@googlegroups.com
>> <mailto:sqlalchemy@googlegroups.com>.
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy+unsubscr...@googlegroups.com
> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
> To post to this group, send email to sqlalchemy@googlegroups.com
> <mailto:sqlalchemy@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to