[sqlalchemy] Resetting primay-key id

2018-01-31 Thread shrey . chauhan
Hi all, I have been using sqlalchemy for my projects, recently I came across a situation where my id(BigInteger) has over flown, I use postgres, I know in postgres I can reset my autoincrement using this query: 'ALTER SEQUENCE tablename_id_seq RESTART WITH 1', is there anything like this in

[sqlalchemy] Re: Not able to filter json column filter in flask-sqlalchemy

2017-12-08 Thread shrey . chauhan
One more doubt is, is there a way to filter on the full json something like this: in your example only: print(Session.query(Student).filter(Student.data_test =={'foo':'bar'}).first()) -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post

[sqlalchemy] Re: Not able to filter json column filter in flask-sqlalchemy

2017-12-07 Thread shrey . chauhan
*VERSION* it was, was working with pg9.2, upgraded to pg9.6 and everything works fine now. Thank you so much. -- 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

[sqlalchemy] Re: Not able to filter json column filter in flask-sqlalchemy

2017-12-07 Thread shrey . chauhan
Hi, I tried using direct plain JSON: my model class Student(db.Model): __tablename__= 'students' id=db.Column(db.Integer, primary_key=True,autoincrement=True) name=db.Column(db.String(200)) roll_no=db.Column(db.Integer) data_test=db.Column(db.JSON) I tried this: *a =

[sqlalchemy] Re: Not able to filter json column filter in flask-sqlalchemy

2017-12-06 Thread shrey . chauhan
Hi Mike, as you said I tried this: *from sqlalchemy.dialects import postgresql class Student(db.Model): # ...data_test=db.Column(postgresql.JSON) * and I tried querying like this: *a = Student.query.filter(Student.data_test["foo"].astext =="bar").first()* tried this as well: *a =

[sqlalchemy] Not able to filter json column filter in flask-sqlalchemy

2017-12-06 Thread shrey . chauhan
Hi, I am using flask-sqlalchemy in my project, but I am not able to understand how to query(filter_by) on a json column test_example: #I am using Postgresql backend app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:postgres@localhost:5432/test_db' db =

[sqlalchemy] Re: ImportError: cannot import name postgresql

2017-06-19 Thread shrey . chauhan
this is the stack trace : [Mon Jun 19 18:11:01.431528 2017] [:error] [pid 18592] [remote 10.11.12.15:128] Traceback (most recent call last): [Mon Jun 19 18:11:01.431548 2017] [:error] [pid 18592] [remote 10.11.12.15:128] File "/var/lib/enclouden-orchestrator/enclouden-orchestrator.wsgi",

[sqlalchemy] ImportError: cannot import name postgresql

2017-06-19 Thread shrey . chauhan
Hi, I am using a remote postgres server: *PostgreSQL 9.6.2sqlalchemy 1.1.10* running my app on Apache webserver, but whe i try hitting any API i get this error- *ImportError:* *cannot import name postgresql* this is the line which is creating issues :-* from sqlalchemy.dialects import

[sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-12 Thread shrey . chauhan
Sorry not the first one, but the second one -- 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/help/mcve for a full description.

[sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-11 Thread shrey . chauhan
Thanks Mike for suggestions, was able to solve both the issues with slight changes in the db models added lazy='dynamic' on both sides where back_populates is being used -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

Re: [sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-11 Thread shrey . chauhan
Yes Mike will do that, mostly its marshmallow model schema which is creating the object, as I am using Flask + marshmallow for APIs, apart from that I have another issue, which i am not able to uderstand: I have a many-to-many relationship between 2 models, same as posted above, still ill put

[sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-10 Thread shrey . chauhan
A package object is getting created, and its inserting it into database, have to debug why is it inserting into db Somehow i got it working, added: db.session.rollback(), before append statement Dont know whether its the right approach Thanks -- SQLAlchemy - The Python SQL Toolkit and

[sqlalchemy] Re: insertion into association table, giving integrityerror

2017-04-09 Thread shrey . chauhan
Traceback (most recent call last): File "/home/schauhan/NewOrchestrator/session_broker/session_broker/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File

[sqlalchemy] insertion into association table, giving integrityerror

2017-04-09 Thread shrey . chauhan
I am working with a python application where I am using flask-sqlalchemy as ORM, here I am facing a situation due to some reason I am getting integrity error, i ll show the models: (I have a many to many relationship between these 2 models) class Package(db.Model, BaseMixin): __tablename__