Is it possible to group or order by a field in a many to one related table?
> class Rental(Base):
> __tablename__ = 'rental'
>
> rental_id = Column(Integer, autoincrement=True, primary_key=True)
> inventory_id = Column(Integer, ForeignKey(Inventory.inventory_id),
> nullable=False)
>
Boy, is my face red now.
I had initialised the _Entity variable in RoleMember's controller wrongly
which directed the delete on a different table...
SOLVED.
Anyhow, many thanks for your help and sorry for my 3-am-code. (Actually it's
2:30 am here ;)
Kr, Dirk
--
You received this message beca
Wow, that was fast :)
You are right, the commit() here finally performs the delete. However, the
situation "main section" etc only arose in this script I compiled for
testing. The project uses Pyramid where transaction.commit() is called
automatically at the end of each request. And as I mentio
On Aug 16, 2011, at 7:39 PM, Dirk Makowski wrote:
> Slowly I am becoming bald...
>
> Here is a stand-alone script that reproduces the behaviour. Code is a bit
> verbose, had copied it from my actual project, and it uses PostgreSQL
> database, and you have to issue an "CREATE SCHEMA sample" bef
On Aug 16, 2011, at 5:37 PM, Mike Gilligan wrote:
> I have a single table that looks similar to the following:
>
> class Equipment(Base):
> type = Column(CHAR(1), primary_key=True)
> sub_type = Column(CHAR(1), primary_key=True)
> code = Column(CHAR(5), primary_key=True)
>
>
> For h
Slowly I am becoming bald...
Here is a stand-alone script that reproduces the behaviour. Code is a bit
verbose, had copied it from my actual project, and it uses PostgreSQL
database, and you have to issue an "CREATE SCHEMA sample" beforehand. Sorry
about that.
The script's output is below. Whe
On Aug 16, 2011, at 6:07 PM, Dirk Makowski wrote:
>
> In some cases it works, in one case it does not, but instead behaves like the
> code in post 1. The statement is issued (at least, the SA logger prints it,
> but I assume it never reaches the database), no errors, no rollbacks, but the
> r
The Pyramid framework uses the Zope transaction manager to supply a
unit-of-work. From its PKG-INFO:
Name: transaction
Summary: Transaction management for Python
Home-page: http://www.zope.org/Products/ZODB
Author: Zope Corporation
This package contains a generic transaction implementation
I have a single table that looks similar to the following:
class Equipment(Base):
type = Column(CHAR(1), primary_key=True)
sub_type = Column(CHAR(1), primary_key=True)
code = Column(CHAR(5), primary_key=True)
For historical purposes, I cannot modify this table. I would like to setup
On Tue, Aug 16, 2011 at 3:59 PM, Dirk Makowski wrote:
> Excellent, Mike, thanks.
>
> This solves my 2nd post, and there's also an equivalent for update. So I
> can use
> sess.query(Role).filter(Role.**id==id).update(values,
> synchronize_session=False)
> where I previously had loaded the entity a
Excellent, Mike, thanks.
This solves my 2nd post, and there's also an equivalent for update. So I can
use
sess.query(Role).filter(Role.id==id).update(values,
synchronize_session=False)
where I previously had loaded the entity and then updated it.
Fine, because I am using the ORM again, the prob
On Tue, Aug 16, 2011 at 1:16 PM, Dirk Makowski wrote:
> P.S.
> In my first attempt, I used the ORM like this
> sess = DbSession()
> entity = sess.query(Role).filter(Role.id==id).one()
> sess.delete(entity)
> sess.flush()
>
> This had worked well. But this way the r
P.S.
In my first attempt, I used the ORM like this
sess = DbSession()
entity = sess.query(Role).filter(Role.id==id).one()
sess.delete(entity)
sess.flush()
This had worked well. But this way the record first is selected before it is
deleted, which I'd liked to elimi
Hi all,
I am building some CRUD pages for a Pyramid web app, and encountered some
(from my point of view as a SQLAlchemy novice) strange behaviour. The UI
sends an ID and inside the controller I'd like to delete the corresponding
record. I use SQL expressions inside a session for this. The dele
14 matches
Mail list logo