is the former sets the length constraint if it
is provided.
--
Audrius Kažukauskas
http://neutrino.lt/
pgp2RVAZ6Mfbz.pgp
Description: PGP signature
(
Event.session_id == last_event.c.session_id,
Event.event_id == last_event.c.event_id
)).subquery()
q = db_session.query(
Session,
event.c.code
).outerjoin(event).order_by(Session.session_id)
--
Audrius Kažukauskas
http://neutrino.lt/
pgpIvTrDJMaJd.pgp
Description: PGP
are
interested:
http://stackoverflow.com/questions/15424199/howto-current-timestamp-at-time-zone-utc
--
Audrius Kažukauskas
http://neutrino.lt/
pgpZSyc5TfDlc.pgp
Description: PGP signature
.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpmldaVSb3TD.pgp
Description: PGP signature
, as at least in PostgreSQL temporary tables exist only for a
connection they were created in. Not sure how they work in other RDBMS.
If you meant the views, then map and query them as ordinary tables.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpNQdc7Wuvvk.pgp
Description: PGP signature
dbSession.query(models.User).filter(models.User.contains(name))
--
Audrius Kažukauskas
http://neutrino.lt/
pgpoIzBxhu_El.pgp
Description: PGP signature
On Tue, 2013-01-29 at 20:19:45 +0200, Audrius Kažukauskas wrote:
How about using
dbSession.query(models.User).filter(models.User.contains(name))
Scratch that, this generates LIKE, while you need ILIKE.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpWASdq7rqCV.pgp
Description: PGP
, because Query works with classes. Try adding echo=True to
create_engine() to see the actual SQL emitted, it should be correct.
In your example you forgot to add newly created p object to a session:
s.add(p)
s.commit()
Your Person class is missing __tablename__ as well.
--
Audrius Kažukauskas
a class as self argument. When that query returns a result (an
instance of this class), the hybrid property will work on that instance
as well.
I also recreated your hybrid example and I can't see any problems: the
query emits correct SQL, and hybrid on returned instance also works.
--
Audrius
(Model.date).between(2, 6)
).all()
[0]
http://docs.sqlalchemy.org/en/rel_0_8/core/expression_api.html#sqlalchemy.sql.expression.func
--
Audrius Kažukauskas
http://neutrino.lt/
pgpCIaDFcPczZ.pgp
Description: PGP signature
extracting the substring from the string)
Although I'm not familiar with this stuff, but perhaps this would be
better suited for PostGIS and GeoAlchemy?
--
Audrius Kažukauskas
http://neutrino.lt/
pgpsdWeHED66y.pgp
Description: PGP signature
faster is to try both versions with your data:
func.rtrim(func.ltrim(Point.data, 'POINT('), ')')
--
Audrius Kažukauskas
http://neutrino.lt/
pgpGGVCOIFEdu.pgp
Description: PGP signature
it would look nicer:
db.session.query(Mark.tags).filter(Mark.tags.contains(['foo'])).all()
--
Audrius Kažukauskas
http://neutrino.lt/
pgpMP658DTbXp.pgp
Description: PGP signature
= db_session.query(subq.c.field1, func.count(subq.c.field1)).\
group_by(subq.c.field1)
You may want to look at
http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html#using-subqueries
for more examples and explanations.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpm5J0P9Pr7X.pgp
Description: PGP
is to use separate virtualenvs for each of your projects (if
you're not doing this already). Since SQLAlchemy 0.8 is not released
yet, you'd need to issue pip (from within virtualenv) as follows:
pip install -U -e
hg+https://bitbucket.org/sqlalchemy/sqlalchemy#egg=SQLAlchemy
--
Audrius
). In that case index simply won't be used by the query planner.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpEoDeVdzBKx.pgp
Description: PGP signature
are disabled by default (for backwards
compatibility), so must be enabled separately for each database
connection separately.
That's the purpose of the event handler you have included in env.py --
to execute 'PRAGMA foreign_keys=ON' for each new connection.
--
Audrius Kažukauskas
http://neutrino.lt
to call it, the event handler is called every time when
new connection is made to your SQLite database (note the decorator above
it).
--
Audrius Kažukauskas
http://neutrino.lt/
pgpDoppfbOy1V.pgp
Description: PGP signature
keys constraint on.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpa1ChHh8lDI.pgp
Description: PGP signature
exception due to foreign key
constraint).
--
Audrius Kažukauskas
http://neutrino.lt/
from sqlalchemy import *
from sqlalchemy import event
from sqlalchemy.orm import *
from sqlalchemy.engine import Engine
from sqlalchemy.ext.declarative import declarative_base
db_engine = create_engine('sqlite
planning to).
--
Audrius Kažukauskas
http://neutrino.lt/
pgpj5yyZ61cGu.pgp
Description: PGP signature
gave you in env.py? Perhaps
that is all that's needed for SQLite's foreign key constraint to take
effect in Alembic migration scripts.
--
Audrius Kažukauskas
http://neutrino.lt/
pgp0qKR68LGn1.pgp
Description: PGP signature
too old version of SQLAlchemy
(0.5.8). I suggest to try out the latest version 0.7.9.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpsGOaXAu2Ds.pgp
Description: PGP signature
that appeared on this same
mailing list in the past.
--
Audrius Kažukauskas
http://neutrino.lt/
pgpzeyUapHmVy.pgp
Description: PGP signature
as using __getitem__), and I would
like to keep the symmetry between Core and ORM methods. Will add it
back in the future, if (when) support for it comes.
Thanks for your comments!
--
Audrius Kažukauskas
http://neutrino.lt/
pgp8JwLxlfE5e.pgp
Description: PGP signature
On Sun, 2012-08-12 at 11:07:18 -0700, Zhe Wu wrote:
def __init__(self, body, author, story):
Here arguments are body, author, story.
comment = Comment(author, story, body)
And here they are author, story, body. I believe that's the source of
your problem.
--
Audrius Kažukauskas
26 matches
Mail list logo