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
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
*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
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 =
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 =
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 =
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",
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
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.
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,
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
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
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
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__
14 matches
Mail list logo