hello all :)
from the past years, i've been working on solutions to the problem
described by Jean (we are co-workers, and we use twisted and sqlalchemy,
A LOT), and as everybody may already know, it's a very complicated
combination, since we have to do a lot of code around to have a
I have a PostgreSQL function discounted_price(packages%ROWTYPE), where
packages is a table. I would like to add a property on the model
corresponding
to the packages table which returns the result of the discounted_price
function.
Currently I have this which works:
@property
def
so anytime you say:
myobject.someattribute
you return a promise? because with the ORM, any attribute can trigger a SQL
query.
On Sep 8, 2014, at 9:08 AM, Richard Gerd Kuesters rich...@humantech.com.br
wrote:
hello all :)
from the past years, i've been working on solutions to
put text() in there:
func.discounted_price(text(packages.*))
On Sep 8, 2014, at 9:59 AM, Tyler Bondy ty.bo...@gmail.com wrote:
I have a PostgreSQL function discounted_price(packages%ROWTYPE), where
packages is a table. I would like to add a property on the model
corresponding
to the
hello Mike!
yeap, that would be the point. even though the object might already have
this value somewhere, the result would be a promise, always.
best regards,
richard.
On 09/08/2014 11:31 AM, Michael Bayer wrote:
so anytime you say:
myobject.someattribute
you return a promise? because
its almost like if it could return a promise, but then some kind of syntactical
magic would just handle that we already know it's there, and just hide it, and
then just do some kind of deferment so that we can just write the next line of
code right below it. because promises and deferreds, it
Hmm, I've tried that and gotten the following error:
ProgrammingError: (ProgrammingError) function discounted_price(unknown) is
not unique
LINE 1: SELECT discounted_price('packages.*') AS discounted_price_1
^
HINT: Could not choose a best candidate function. You might need to
Ahh I think I've got it now, thanks a bunch.
On Monday, September 8, 2014 12:13:41 PM UTC-4, Michael Bayer wrote:
SQLAlchemy will send exactly what string you want. But you have to figure
out what Postgresql wants. Maybe you don’t want those quotes in there?
Using SQLAlchemy 0.9.7 against a PostgreSQL 9.2 database.
with e as an Engine:
i = 1
with e.begin() as conn:
x = conn.execute('select * from test01')
print x.fetchall()
with conn.contextual_connect() as conn2:
with conn2.begin():
i += 1
On Sep 8, 2014, at 12:27 PM, Marius van Niekerk marius.v.niek...@gmail.com
wrote:
Using SQLAlchemy 0.9.7 against a PostgreSQL 9.2 database.
with e as an Engine:
i = 1
with e.begin() as conn:
x = conn.execute('select * from test01')
print x.fetchall()
with
the thing is i'm comfortable with all that. what i'm trying to automate,
somehow, is the need to let my fishes transit around deferreds (or
threads) objects that once belongs to one session and can easily be lost
if its states changes in this process, including proper session handling
(open,
Hi!
Maybe I wasn't very clear with what I was suggesting
think of the code:
value = object.attribute
be like:
do_stuff_and_reply_user(myvar):
return return_to_user(process_it(myvar)) #deferreds again xD
object.attribute.addCallback(do_stuff_and_reply_user)
#or something like
deff =
When using ORM, is there a way to update without first selecting an object?
For example, if I am updating a User record's name in the database and I
have its primary key, I'd like to just execute one query and update it
straight away. But in order to do so I must run 2 queries, first to select
In one of the YouTube videos on SQLAlchemy Mike said that some of the large
users of SQLAlchemy prefer to use plain SQLAlchemy instead of SQLAlchemy
ORM. What are the reasons behind that? I'm wondering because I started off
with ORM and though I like it I've been wondering whether I might be
use the update() method:
http://docs.sqlalchemy.org/en/rel_0_9/orm/query.html?highlight=query.update#sqlalchemy.orm.query.Query.update
On Sep 8, 2014, at 3:12 PM, alchemy1 veerukrish...@hotmail.com wrote:
When using ORM, is there a way to update without first selecting an object?
For
On Sep 8, 2014, at 3:14 PM, alchemy1 veerukrish...@hotmail.com wrote:
In one of the YouTube videos on SQLAlchemy Mike said that some of the large
users of SQLAlchemy prefer to use plain SQLAlchemy instead of SQLAlchemy ORM.
What are the reasons behind that?
the Core by itself is much much
From personal experience, others may disagree:
For most functions in a webapp (or most other apps), you want to use the
ORM -- which gives you a natural way to surface and manipulate the
underlying data as Python objects.
When it comes to admin tools, maintenance work, migrations, etc -- you
I have a model defined with:
from app import db
from sqlalchemy.dialects import postgresql
class TableIpAddress(db.Model):
__tablename__ = 'ipaddress'
idipaddress = db.Column( postgresql.UUID, primary_key=True )
ipaddress = db.Column( postgresql.CIDR, index=True, nullable=False )
I would
in your stack trace is this weird string postgresql.driver.pq3, googling it
reveals this is the py-postgresql driver. This is not at all a well-known
driver and I suggest switching to psycopg2, which will probably just work in
this case.
On Sep 8, 2014, at 4:23 PM, Raymond Burkholder
in your stack trace is this weird string postgresql.driver.pq3, googling
it
reveals this is the py-postgresql driver. This is not at all a well-known
driver
and I suggest switching to psycopg2, which will probably just work in this
case.
Does psycopg2 parameterize it's queries, and
psycopg2 doesn't standardize on prepared statements so i think it does string
parameterization.I don't believe postgresql offers much advantage to native
parameters.
On Sep 8, 2014, at 5:24 PM, Raymond Burkholder r...@oneunified.net wrote:
in your stack trace is this weird string
Unfortunately, dumping SQL Server (in favor of Oracle) may not be an
option, due to management concerns and other factors. Still working on it.
However, I did manage to get this working with pymssql. Apparently, there
is a bug with pyodbc and 64-bit python
(see
Looking at that issue, and suggested fix... I think you're best going with
that route. the stock apple Python is usually pretty bad, and it seems to
be the compile settings apple selected, not python. apple's version is
often VERY out of date and has some weird settings. It's screwed me and
Hi Jonathan,
For the record, in my current setup, I installed python via Homebrew. Prior
to that, I was using the Apple build of python, which would have been the
32-bit version that came with Lion.
Greg--
On Mon, Sep 8, 2014 at 6:31 PM, Jonathan Vanasco jonat...@findmeon.com
wrote:
Looking at
24 matches
Mail list logo