[sqlalchemy] Re: Postgres database: open and close connection

2017-10-06 Thread Martin Cigorraga
Hello Simon, Jonathan TYVM for your feedback, I'll try your recommendations! -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/

Re: [sqlalchemy] ROLLBACK with no reason.

2017-10-06 Thread Mike Bayer
ROLLBACK is emitted when a connection is released to the connection pool. The ORM session requires that session.commit() is called. If this Session is integrated with the zope transaction manager, then the transaction manager will call it, but if not then you need to call session.commit() explic

[sqlalchemy] ROLLBACK with no reason.

2017-10-06 Thread Srikanth Bemineni
Hi, SQLalchemy rollbacks an insert command with out the reason for failure. I am using Mysql 2017-10-06 15:23:22,170 INFO [sqlalchemy.engine.base.Engine:1140][b'uWSGIWorker2Core0'] INSERT INTO group_message_22f9b36c (group_id, group_topic_id, score, user_id, uname, msg, created_at, updated_

Re: [sqlalchemy] Postgres database: open and close connection

2017-10-06 Thread Jonathan Vanasco
On Friday, October 6, 2017 at 7:23:45 AM UTC-4, Simon King wrote: > > Your code probably needs to do something like this: > > engine = sqlalchemy.create_engine(url, client_encoding='utf8') > connection = engine.connect() > > "engine.connect()" will raise an exception if it fails to con

Re: [sqlalchemy] Postgres database: open and close connection

2017-10-06 Thread Simon King
On Fri, Oct 6, 2017 at 9:59 AM, Martin Cigorraga wrote: > Hi, > > I'm trying to create a simple function to check the reachability of a > Postgres database using the http method GET; if the connection can't be > established, it should respond with a custom http error number. > > This is what I got

[sqlalchemy] Postgres database: open and close connection

2017-10-06 Thread Martin Cigorraga
Hi, I'm trying to create a simple function to check the reachability of a Postgres database using the http method GET; if the connection can't be established, it should respond with a custom http error number. This is what I got so far: https://pastebin.com/rh3t6nYN Being fairly new to Python