My use case is the following: each SalesItem requires a calcPriceList and a
salesPriceList (of type PriceList) attached to it.
For that, SalesItem has two fields:
calcpricelist_id = Column(BigInteger, ForeignKey(PriceList.id),
nullable=False)
salespricelist_id = Column(BigInteger,
I often pass db query in template context, and in template I check if
it exists, that render one html block, else other html block.
Can I in sqlalchemy check existance of query?
Now I simply call query.count() in template as temporary solution.
For example:
q =
query.first() may do the trick.
Regards
Robert
Am 18.11.2011 15:25 schrieb lestat lestatc...@googlemail.com:
I often pass db query in template context, and in template I check if
it exists, that render one html block, else other html block.
Can I in sqlalchemy check existance of query?
How silly of me not to have checked that in the docs. Rather embarrassing
really :) Thanks.
--
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/-/rTk1ea1hvrgJ.
To
On Nov 17, 2011, at 4:08 PM, Jackson, Cameron wrote:
Hmmm. I have a Windows machine on my desk, and the only linux boxes I have
access to (through SSH) don't have internet access.
So I browsed to the link you had in the hg clone command, and downloaded from
the zip file at the left of
I'm using sqlalchemy 0.6.6 and sqlite 3.6.22 on Python 2.6. When I do:
In [1]: for i in ses.query(UserSnapshot):
...: print i
...: if i is None: break
...:
I see:
...
twopt.UserSnapshot object at 0x86a52f50
twopt.UserSnapshot object at 0x86a55050
Oy...this turned out to be due to my own fiddling with the DB outside
of sqlalchemy, where I swapped out the user_snapshot table with a copy
that had
id int primary key
instead of
id integer primary key
Apparently sqlite treats these differently:
sqlite create table a (a integer primary