Postgres can handle timezones fairly well. Using a direct select you can
see how it handles daylight saving correctly:
test=# select
'2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone,
'2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone +
interval '7
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi.
I'm here again with a problem I don't know if it is a bug in SA or in my
code.
Here is the offending code:
from sqlalchemy import schema, types, sql, create_engine
metadata = schema.MetaData()
test = schema.Table(
'test', metadata,
Today I met a strange problem with SqlAlchemy and Postgresql. The
code is like this:
def update_user(user_id, sess):
user = sess.query(User).get(user_id).one()
user.last_activity_time = datetime.now()
session.commit() It hangs here forever.
In the code above,
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Manlio Perillo
Sent: 29 January 2010 13:15
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] problem when executing multiple insert
statements and boolean type
-BEGIN
On Jan 29, 2010, at 15:01 , 一首诗 wrote:
What might cause this kind of problem?
Possibly waiting on locks. Do you have any concurrent transactions modifying
the same data?
When the problem appears, run `select * from pg_stat_activity` to see whether
there are locking issues.
To see the locks
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
King Simon-NFHD78 ha scritto:
[...]
params = [ {'x': 1}, {'x': 2, 'y': False} ]
engine.execute(test.insert(), params)
print engine.execute(test.select()).fetchall()
[...]
This should print:
[(1, True), (2, False)]
and instead it
Can someone please help me to figure out the equivalent of this sql query to
sqlalchemy
This my nested_category table:
+-+--+-+-+
| category_id | name | lft | rgt |
+-+--+-+-+
| 1 |
Wichert Akkerman wrote:
Which outputs:
2010-01-15 12:30:00+01:00
2010-08-15 12:30:00+01:00
The second timestamp should have +02:00 as timezone due do daylight
saving differences. Unfortuantely the timezone information reported on
the column has a fixed offset instead of the more
Manlio Perillo wrote:
-BEGIN PGP SIGNED MESSAGE-
Ah, thanks.
I think a check has been added in 0.6 so that an exception is raised if
you don't follow this advice.
No, I'm using the version from trunk, and there is no exception or
warnings.
the error is raised if a subsequent
Hi Daniel,
Good question as I like to learn this way myself. I'm also just getting
started, but I found the overview in the Pylons book to be helpful and a
good intro (by my approximation at least) into to the pattern you're
talking about. It might be a bit more basic than you're looking
Given the following relationships:
employees_table = Table('employees', metadata,
Column('id', Integer, primary_key=True),
Column('row_type', Integer, nullable=False)
Column('name', String(50)),
Column('is_certified', Boolean)
)
employee_mapper = mapper(Employee, employees_table,
Yoann Roman wrote:
Given the following relationships:
employees_table = Table('employees', metadata,
Column('id', Integer, primary_key=True),
Column('row_type', Integer, nullable=False)
Column('name', String(50)),
Column('is_certified', Boolean)
)
employee_mapper =
I’ve been stuck trying to get the pylons application to connect to my
database. I was able to connect to the database through a python
shell in the “virtualenv” as you can see below. The app acts like it
can connect to the database, but not to the table.
I admit this is my first pylons project
Hi James,
it would be helpful if you posted the call stack where that error
occurs, and the code leading up to the failed query execution, which
database and driver (the first word in the engine URL).
Without further details, the first place I would look is where the
session (or connection) gets
Greetings, Alchemists,
what's the best way to work with temp tables on Postgres?
It's fairly easy to have one created:
tmp_foo = Table('tmp_foo',
metadata,
Column('id', Integer, unique=True),
Column('bar', Integer),
Hi Juan,
this will do it in version 10.5.8 (and probably earlier:
nested_category = Table(
'nested_category',
MetaData(),
Column('category_id', Integer, primary_key=True),
Column('name', Text, nullable=False),
Column('lft', Integer, nullable=False),
Column('rgt', Integer,
On Jan 29, 2010, at 7:27 PM, Yannick Gingras wrote:
Greetings, Alchemists,
what's the best way to work with temp tables on Postgres?
It's fairly easy to have one created:
tmp_foo = Table('tmp_foo',
metadata,
Column('id', Integer, unique=True),
Another quick way of troubleshooting hangs is the tool pg_top, in
which you might see a process in the state “Idle in transaction”. This
state means that some database operations have been performed in a
transaction on that connection but the transaction has not yet been
committed.
Those database
On January 29, 2010, Michael Bayer wrote:
One work around would be to use ON COMMIT DROP but I don't now how
to do that since Table() has no `suffixes` parameter.
from sqlalchemy.schema import CreateTable
from sqlalchemy.ext.compiler import compiles
@compiles(CreateTable)
def
On Jan 29, 2010, at 10:52 PM, Yannick Gingras wrote:
I usually go with the IN clause but I wonder if its possible to
write PG stored procedures that can get to xapian as well (since you
can write them in python or any other language).
I would not be too hard to make it run on in
Yeah, there might be another transaction modifying the same data
(actually the same line of data in database).
But I didn't expect that might cause problem before!
Oh, if that's true, then I have to add some lock in my code to avoid
that. That's a big problem.
On Jan 29, 10:13 pm, Alex
21 matches
Mail list logo