[sqlalchemy] SQL Alchemy is bugging out my Redshift table.

2018-08-30 Thread laurent . bastien
Hi everyone. I've been experiencing a very weird issue, and I hope someone could help me with it. I've mapped a Redshift table using SQL Alchemy's ORM. Here is my code. from sqlalchemy.ext.automap import automap_base from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy

[sqlalchemy] how to properly remove a one-to-one relationship ?

2015-06-22 Thread laurent
Hello all, What is the proper way to fully remove a one-to-one related object ? I I do Session.delete(a.b) print a.b # b is still here ... What am I missing ? Thanks, Laurent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

[sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Laurent Meunier
-to extract the time part of my DateTime field in .filter(). Should I add a Time column ? Or is it possible to use only the DateTime column? Thanks. -- Laurent Meunier laur...@deltalima.net -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Laurent Meunier
as expected, but I'm looking for a more efficient way of doing this. Thanks. -- Laurent Meunier laur...@deltalima.net -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread laurent+sqlalchemy
with a lot of between 2013-08-30 06:00:00 and 2013-08-30 11:00:00 (one for each day). This will certainly work as expected, but I'm looking for a more efficient way of doing this. Thanks. -- Laurent Meunier laur...@deltalima.net Ahh - I see. Oh well, I'm sure someone with infinitely better SQL skills

Re: [sqlalchemy] Re: Modeling a Tree-looking structure in SqlAlchemy.

2010-12-13 Thread Laurent Rahuel
Hello, You should also take a look at http://pypi.python.org/pypi/sqlamp/0.5.2, an implementation of Materialized Path for SQLAlchemy. Regards, Laurent Le 13 déc. 2010 à 23:30, Russell Warren a écrit : Sorry, I just saw I messed up the nested sets SQLA example link. Here is the right one

Re: [sqlalchemy] Re: find the table columns

2010-01-21 Thread laurent FRANCOIS
On Thu, 2010-01-14 at 05:29 -0800, Kosu wrote: try this: user.__table__.c.keys() should work Kos Rafal AttributeError: 'User' object has no attribute '__table__' thanks anyway On 14 Sty, 11:39, laurent FRANCOIS lau.franc...@worldonline.fr wrote: Hello everybody Let's say

[sqlalchemy] find the table columns

2010-01-14 Thread laurent FRANCOIS
no? Thanks Laurent FRANCOIS -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options

[sqlalchemy] more than one one to many relation

2009-11-21 Thread laurent FRANCOIS
Hello, What is the pattern for more than one relation one to many. I have on parent with 2 childs. parent_table = Table('parent', metadata, Column('parent_id', Integer, primary_key=True) ) child1_table = Table('child1', metadata,

[sqlalchemy] Re: setattr and mapped ORM

2009-10-24 Thread laurent FRANCOIS
On Wed, 2009-10-21 at 09:24 -0700, David Gardner wrote: Using setattr() shouldn't be a problem, however the __dict__ attribute also has other things in there like _sa_instance_state that I don't believe you want to copy to the new item. Try this instead: for col in object_mapper(update):

[sqlalchemy] Re: setattr and mapped ORM

2009-10-24 Thread laurent FRANCOIS
On Wed, 2009-10-21 at 09:24 -0700, David Gardner wrote: Using setattr() shouldn't be a problem, however the __dict__ attribute also has other things in there like _sa_instance_state that I don't believe you want to copy to the new item. Try this instead: for col in object_mapper(update):

[sqlalchemy] Update session extension after creation

2009-09-10 Thread Laurent Rahuel
Hi, I'm currently using a webframework which uses sqlalchemy. Each time a request hits the server, the framework creates a session object I can use during the page creation. I wish you could update this session with one of my SessionExtension but I'm facing a small problem: I tested my code

[sqlalchemy] Re: Update session extension after creation

2009-09-10 Thread Laurent Rahuel
'extensions' = Sounds like my scoped session doesn't have any extension at all (even empty) Regards, Laurent On 10 sep, 14:09, Mike Conley mconl...@gmail.com wrote: Well, it looks like configure is a class method on Session, so when you do session.configure() you are configuring future sessions

[sqlalchemy] : Declarative and association object same model

2009-09-04 Thread Laurent Rahuel
a primaryjoin and a secondaryjoin but with no success. Sounds like I don't understand what are primaryjoin and a secondaryjoin expressions. Any idea ? Regards, Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: : Declarative and association object same model

2009-09-04 Thread Laurent Rahuel
Thanks Michael, Everything is OK now. Sorry for the typo, I was renaming my classes. Regards, Laurent Le 04/09/2009 16:30, Michael Bayer a écrit : asrenzo wrote: Here is a primaryjoin, secondaryjoin I tried without success: neighbors = relation(Place, primaryjoin=(Place.id

[sqlalchemy] ForeignKey on a ForeignKey

2009-08-24 Thread Laurent Rahuel
on my pgsql shell, everything is OK. Does anybody have any clue ? Regards, Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com

[sqlalchemy] Re: Migration from django orm: override save method?

2009-06-15 Thread Laurent Rahuel
Hi, You should take a look at MapperExtension. Then you'll be able to add method which would be called depending on the orm actions. For example, you'll be able to add your own custom before_insert or after_insert or after_delete methods. Regards, Laurent Le 15/06/2009 17:36, Didip Kerabat

[sqlalchemy] Re: SQLAchemy behevior

2009-05-09 Thread Laurent Rahuel
): __tablename__ = 'mymodel_table' id = Column(Integer, primary_key=True) slug = Column('type', String(50)) ... __mapper_args__ = {'extension': MyModelExtension()} Then everything should be OK Regards, Laurent Tcourbon a écrit : Hi there ! I'm new to SQLAlchemy (and python actually

[sqlalchemy] Re: Self-referential with DeclarativeBase

2009-04-06 Thread Laurent Rahuel
Hi, As you are defining Country when you use it within your relation, you need to define your relation like this : parent = relation(Country, backref=backref('child'), cascade=all) Note the quotes around Country. Regards, Laurent Cedric a écrit : Hi, I'm trying to migrate my

[sqlalchemy] Re: Session and pre/post callable methods

2009-04-02 Thread Laurent Rahuel
Thanks for this quick response Michael Bayer a écrit : look into using MapperExtension and/or SessionExtension to add hooks within the flush process. Laurent Rahuel wrote: Hi, I'm currently trying to port a Django based application using sqlalchemy and I'm a bit confused with some

[sqlalchemy] Session and pre/post callable methods

2009-04-01 Thread Laurent Rahuel
Declarative models to be able to do the same ? Regards, Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from

[sqlalchemy] foreignkey and relation synchronization

2009-02-28 Thread laurent
Hello, There's a behaviour in SA that is not clear to me: if we look at the example (User and Address) from the docs, we can change either the related object or the foreign key For example: ad = Address(email_address='j...@google.com') ad.user = jack OR ad.user_id = 1 What is the prefered

[sqlalchemy]

2009-02-21 Thread laurent FRANCOIS
Hello Is it obvious that this model: % ##Class Table user_table = Table( 'user', metadata, Column('user_id', Integer, primary_key=True), Column('fname', Unicode(50), default=''),

[sqlalchemy] Re: session.merge()

2009-01-17 Thread Laurent Rahuel
values from the XML and session.commit() will update the database else create a new mapped object with values from the XML file, session.add(ob), and session.commit() will add the record into database Regards, Laurent n00b a écrit : greetings, i'm batch processing xml documents

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
On Jan 9, 9:24 pm, Michael Bayer [EMAIL PROTECTED] wrote: So if I understand what youre looking to do here, youd like a keyword to be deleted when the last parent is removed ? That is exactly what I would like... if youd like to check for this condition after each flush you can do it

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
On Jan 10, 4:00 pm, Michael Bayer [EMAIL PROTECTED] wrote: A statement issued in SessionExtension would fire unconditionally upon any flush(), so thats the trigger there. not sure what you mean by track here, if it means you want to know the keywords that were deleted, you'd just issue the

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
how about, go into sessionextension.after_flush(), make a new session local to the operation, issue a Query with the Select for all orphan keywords, delete them all and flush that sub-session, then expunge() those keywords from the parent session sent to after_flush, like this: [...]

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-09 Thread Laurent Houdard
Can anybody help me ? ...No one ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to

[sqlalchemy] Inheritance and relation in primary table

2006-11-05 Thread laurent rahuel
an owner to my Bases objects. Any idea ?? Regards, Laurent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from

[sqlalchemy] Re: Inheritance and relation in primary table

2006-11-05 Thread laurent rahuel
-8 -*- # * BEGIN LICENSE BLOCK * # This file is part of NOMDUPRODUIT. # Copyright (c) 2004 laurent Rahuel and contributors. All rights # reserved. # # NOMDUPRODUIT is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published

[sqlalchemy] Re: Inheritance and relation in primary table

2006-11-05 Thread laurent rahuel
Tried with a postgresql database and I get another error right in my metadata.create_all(). I get a SQLError: (ProgrammingError) from postgres telling me I got something wrong while creating constraint on unexisting key into table bases. CREATE TABLE folders ( id INTEGER NOT NULL,