[sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Duke Dougal
Is there a way to have create_engine NOT create a sqlite database in the event that one does not exist? thanks -- 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

Re: [sqlalchemy] error in query many to many

2015-04-04 Thread Mike Bayer
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] error in query many to many

2015-04-04 Thread biohegedus
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

[sqlalchemy] SQLAlchemy delay reconnecting

2015-04-04 Thread Henrique Fleury
When the database restarts my services are flooding the database connection. I wonder if in SQLAlchemy has a parameter that step create_engine () it does a delay between an attempt and another connection. I need him to try to connect if you can not it wait X time to make a new attempt. --

Re: [sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Mike Bayer
On 4/4/15 4:38 AM, Duke Dougal wrote: Is there a way to have create_engine NOT create a sqlite database in the event that one does not exist? I think you need to reword this question. Right now it says, Is there a way to call a function X() and have it NOT do X? Doesn't make much sense.

Re: [sqlalchemy] error in query many to many

2015-04-04 Thread Mike Bayer
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

Re: [sqlalchemy] SQLAlchemy delay reconnecting

2015-04-04 Thread Mike Bayer
On 4/4/15 11:42 AM, Henrique Fleury wrote: When the database restarts my services are flooding the database connection. I wonder if in SQLAlchemy has a parameter that step create_engine () it does a delay between an attempt and another connection. I need him to try to connect if you can not

[sqlalchemy] Re: error in query many to many

2015-04-04 Thread biohegedus
Thanks for your input! It helped my to find a bug in my code. I inserted 0 for false, 1 and 2 for true. However, inserting a bad value for boolean using SQLAlchemy should also result in an exception and not only selecting a boolean with a bad value. Thanks again, Tamas On Saturday, April 4,

[sqlalchemy] Re: SQLAlchemy delay reconnecting

2015-04-04 Thread Jonathan Vanasco
I've had issues like this in the past, and in the worst situations your services can end up giving your system a ddos. what i usually do to avoid this, is implement a delay on the connection pool itself, and have each service cycle through a set of delays with a different starting point in

[sqlalchemy] Deleting object attributes to avoid merge comparison no longer works in 1.0

2015-04-04 Thread Russ
I have some buried-in-the-codebase-since-0.7 upsert code that uses `merge`. In order to avoid certain attributes from being used in the merge comparison, the attributes were deleted using delattr.. The code looks something like this: db_obj = sess.query(obj_type).filter_by(**filters).one() pk

Re: [sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Daniel Kerkow
Am 05.04.2015 01:58 schrieb Mike Bayer mike...@zzzcomputing.com: On 4/4/15 7:47 PM, Daniel Kerkow wrote: 2015-04-05 1:29 GMT+02:00 Mike Bayer mike...@zzzcomputing.com: On 4/4/15 7:22 PM, Daniel Kerkow wrote: Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the

Re: [sqlalchemy] Deleting object attributes to avoid merge comparison no longer works in 1.0

2015-04-04 Thread Mike Bayer
On 4/5/15 12:32 AM, Russ wrote: I have some buried-in-the-codebase-since-0.7 upsert code that uses `merge`. In order to avoid certain attributes from being used in the merge comparison, the attributes were deleted using delattr.. The code looks something like this: db_obj =

Re: [sqlalchemy] Re: error in query many to many

2015-04-04 Thread Mike Bayer
On 4/5/15 12:54 AM, biohege...@gmail.com wrote: Thanks for your input! It helped my to find a bug in my code. I inserted 0 for false, 1 and 2 for true. However, inserting a bad value for boolean using SQLAlchemy should also result in an exception and not only selecting a boolean with a bad

[sqlalchemy] Re: SQLAlchemy delay reconnecting

2015-04-04 Thread Henrique Fleury
this error happened. Traceback (most recent call last): File server.py, line 112, in module location = Location(galileo, gateway, processing) File C:\Desenvolvimento\locations\Location.py, line 41, in __init__ 'device' : Table('device', galileo, autoload=True,

[sqlalchemy] Re: SQLAlchemy delay reconnecting

2015-04-04 Thread Henrique Fleury
I researched and found another way to do which was: from retrying import retry @retry(stop_max_delay=1) def get_con_gateway(self): con = self.gateway['engine'].connect() return con I used retrying module and made a method to create the connections. Em sábado, 4 de abril

Re: [sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Duke Dougal
OK I'll try again, apologies for not being clear. I want to connect to a Sqlite database if it exists, but if it does not exist, I want to execute my custom database creation code., which looks like this: def setupArchiveTables(db): import sqlite3 conn =

Re: [sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Mike Bayer
On 4/4/15 4:10 PM, Duke Dougal wrote: OK I'll try again, apologies for not being clear. I want to connect to a Sqlite database if it exists, but if it does not exist, I want to execute my custom database creation code., which looks like this: then use Python to check for the file: import

[sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Daniel Kerkow
Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the following model using JSONB data type in PostgreSQL. The JSON data looks like {'key1': 'value1', 'key2': 'value2'} The Docs are relatively sparse regarding this topic. How can I query the properties column for containing

Re: [sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Mike Bayer
On 4/4/15 7:22 PM, Daniel Kerkow wrote: Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the following model using JSONB data type in PostgreSQL. The JSON data looks like | {'key1':'value1','key2':'value2'} | The Docs are relatively sparse regarding this topic. the

Re: [sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Daniel Kerkow
2015-04-05 1:29 GMT+02:00 Mike Bayer mike...@zzzcomputing.com: On 4/4/15 7:22 PM, Daniel Kerkow wrote: Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the following model using JSONB data type in PostgreSQL. The JSON data looks like {'key1': 'value1', 'key2':

Re: [sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Mike Bayer
On 4/4/15 7:29 PM, Mike Bayer wrote: On 4/4/15 7:22 PM, Daniel Kerkow wrote: Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the following model using JSONB data type in PostgreSQL. The JSON data looks like | {'key1':'value1','key2':'value2'} | The Docs are

Re: [sqlalchemy] How to query postgresql JSONB columns?

2015-04-04 Thread Mike Bayer
On 4/4/15 7:47 PM, Daniel Kerkow wrote: 2015-04-05 1:29 GMT+02:00 Mike Bayer mike...@zzzcomputing.com mailto:mike...@zzzcomputing.com: On 4/4/15 7:22 PM, Daniel Kerkow wrote: Hi, I am new to SQLAlchemy, doing my first steps with Flask. I have the following model using