Hello,
Using SQLAlchemy 0.7.9 and Flask-SQLAlchhemy 0.16, I want to use Postgres
array.
So my model is as follow :
from sqlalchemy.dialects.postgresql import ARRAY
class Mark(db.Model):
__tablename__ = 'mark'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(200), unique=True)
url = db.Column(db.String(200), unique=True)
description = db.Column(db.Text())
comment = db.Column(db.Text())
tags = db.Column(ARRAY(db.String))
author = db.relationship('User', backref=db.backref('user',
lazy='joined'))
created_at = db.Column(db.DateTime)
updated_at = db.Column(db.DateTime)
Creating the table works fine so I think the class definition is fine. I
inserted a few data in the database but to retrieve them, I have some issue
and can't find the right syntax for doing it right.
Googling I found some keys but note work so far :
- Using func.any()
- Model.column_array.op("@>")(ARRAY("hello", "world")
- and a few others.
Thanks in advance for your help,
Nicolas
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/y8wqQFTE-ZQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.