[sqlalchemy] Re: ORM-level “delete” cascade vs. FOREIGN KEY level “ON DELETE” cascade explanation

2019-10-10 Thread 'Marc Vegetti' via sqlalchemy
relationship. > At the ORM level, *this direction is reversed*. SQLAlchemy handles the > deletion of “child” objects relative to a “parent” from the “parent” side, > which means that delete and delete-orphan cascade are configured on the > *one-to-many* side Marc V. -- SQLA

[sqlalchemy] ORM-level “delete” cascade vs. FOREIGN KEY level “ON DELETE” cascade explanation

2019-10-09 Thread 'Marc Vegetti' via sqlalchemy
simply add the *ondelete='CASCADE'* and expect the same behavior as before ? Best regards, Marc V. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Exa

Re: [sqlalchemy] Approval of changes to records

2018-07-17 Thread Marc
. Your suggestion will be helpful On Monday, July 16, 2018 at 5:24:16 PM UTC+1, Jonathan Vanasco wrote: > > > > On Monday, July 16, 2018 at 4:53:18 AM UTC-4, Marc wrote: >> >> Thank you both Jonathan and Kirk for your helpful comments. I am leaning >> more and more towa

Re: [sqlalchemy] Approval of changes to records

2018-07-16 Thread Marc
requirements and provide additional functionality for 'free' On Sunday, July 15, 2018 at 12:20:56 PM UTC, Kirk wrote: > > On 14 July 2018 at 19:45, Marc > wrote: > > The application has the requirement that authorised users can add >> information to the database, but

[sqlalchemy] Approval of changes to records

2018-07-14 Thread Marc
Hi, Building a web application with PostgreSQL 9.6, SQLAlchemy, Flask and a HTML5 javascript/jquery front-end. The application has the requirement that authorised users can add information to the database, but this information should not be displayed on the public web pages until an admin has

Re: [sqlalchemy] window function madness...

2017-08-25 Thread Marc W Mengel
Mike, Thanks for the patch! I won't get a chance to try it 'till probably Monday, but it looks good. I'll send a note when I've had a chance to try it. -- Marc W. Mengel Computer Services Senior Developer Data Management and Applications Fermi National Accelerator Lab

[sqlalchemy] window function madness...

2017-08-24 Thread Marc Mengel
So I had a query in raw PostgreSQL which was trying to find the start and end of an event in a history table: select jh.job_id, jh.created as start_t, jh.status, min(jh.created) over (PARTITION by jh.job_id ORDER BY jh.created

[sqlalchemy] How does latest sqlalchemy pickle a column?

2014-10-17 Thread Marc Van Olmen
$ LANGUAGE plpythonu STABLE COST 100; ALTER FUNCTION util.unpickle(bytea) My question for sqlalchmy or is this psycopg2 question? is there any data manipulation that is happened before the pickle.loads function gets called? so is there any processing happening before def result_processor(sel

[sqlalchemy] Re: Sqlalchemy and pickling data in a column with Postgresql?

2014-10-17 Thread Marc Van Olmen
hi, after further investigating this didn't turn out to be the issue. ORM code was adding the extra keys in the dictionary. you can consider the issue closed, sorry for the noise. marc On Friday, October 17, 2014 12:11:05 AM UTC-4, Marc Van Olmen wrote: > > Second attempt bec

[sqlalchemy] Sqlalchemy and pickling data in a column with Postgresql?

2014-10-16 Thread Marc Van Olmen
Second attempt because Google Groups doesn't seems to show my question. hi, I'm running into an issue where unpickle a column from slqalchmey managed database in python 2.7.5 + sqlaymchy 0.9.3 + posgresql 9.2.3 is giving different result when I use sqlalchemy to load the pickled column or when

Re: [sqlalchemy] SQLAlchemy 0.8 issue: with appending items to relationship

2013-10-13 Thread Marc Van Olmen
I did some more digging today to see If I can pin down the exact reason: I tested with a unit test, and reduced the code above to bare minimum and not doing references to collections anymore. def serials(self): requiredAmountOfSerials = self.quantity if requiredAmountOfSeria

Re: [sqlalchemy] SQLAlchemy 0.8 issue: with appending items to relationship

2013-10-13 Thread Marc Van Olmen
ed by afterSerials = self._serials Then followed by: Session.flush() So It is similar to what you described, Thanks again. marc On Saturday, October 12, 2013 6:41:19 PM UTC-4, Michael Bayer wrote: > > > On Oct 12, 2013, at 11:54 AM, Marc Van Olmen > > > wrote: > > &

[sqlalchemy] SQLAlchemy 0.8 issue: with appending items to relationship

2013-10-12 Thread Marc Van Olmen
== request_table.c.id, lazy=False), } mapper_cached( MetaSerial, metaserial_table, # save_on_init=False, properties={ 'employee': relationship( Item, primaryjoin=item_table.c.id == metaserial_table.c.id_employee ), '_value&#

Re: [sqlalchemy] Mapping a CTE

2011-08-19 Thread Marc DellaVolpe
non_1 UNION ALL SELECT DATEADD(dd, ?, date) AS [DATEADD_1] FROM all_dates WHERE DATEADD(dd, ?, date) <= CAST(? AS DATETIME) ) SELECT date AS date FROM (SELECT * FROM all_dates) as x WHERE date>='2011-01-15 00:00:00' ORDER BY date DESC OPTION (MAXRECURSION 0) On Thu, Aug 18, 2011 at

Re: [sqlalchemy] Mapping a CTE

2011-08-18 Thread Marc DellaVolpe
used a regular expression to shim in a special comment. This seems hackish but could a similar approach work on mssql? Is it possible to hook into only the top-level/last Select's compile()? Thanks for all of your help. -Marc On Thu, Aug 18, 2011 at 1:37 PM, Michael Bayer wrote: > > On Aug

Re: [sqlalchemy] Mapping a CTE

2011-08-18 Thread Marc DellaVolpe
step, date) <= CAST(:stop AS DATETIME) ) SELECT * FROM all_dates OPTION (MAXRECURSION 0) On Thu, Aug 18, 2011 at 1:08 PM, Marc DellaVolpe wrote: > From what I can tell from > http://msdn.microsoft.com/en-us/library/ms190766.aspx and experimentally, > you can only put CTE's at the top

Re: [sqlalchemy] Mapping a CTE

2011-08-18 Thread Marc DellaVolpe
a CTE to the select and then generating custom SQL for the subclass but I wasn't completely familiar of the compilation workings to determine if this was workable solution to force the CTE to the top of the generated SQL. -Marc On Thu, Aug 18, 2011 at 12:13 PM, Michael Bayer wrote: > >

Re: [sqlalchemy] Mapping a CTE

2011-08-18 Thread Marc DellaVolpe
"DATEADD_1" FROM all_dates WHERE DATEADD(dd, %(step)s, all_dates.date) <= CAST(%(stop)s AS TIMESTAMP WITHOUT TIME ZONE)) SELECT anon_1.date AS anon_1_date FROM (SELECT * FROM all_dates) AS anon_1 -Marc On Thu, Aug 18, 2011 at 11:47 AM, Michael Bayer wrote: > > On Aug 18, 2011, a

[sqlalchemy] Mapping a CTE

2011-08-18 Thread Marc DellaVolpe
selects to transform queries. I have only been able to make the mapping work with .from_statement() however this does not allow for transformations. Any thoughts? Thanks, -Marc with CommonTableExpression.create('all_dates', ['date']) as all_dates: start_exp = cast(bindpara

[sqlalchemy] In case of joinedload_all how do I order by on a columns of those relations

2011-06-28 Thread Marc Van Olmen
(joinedload_all(User.orders, Order.items, Item.keywords)) I would like to do something like: query.options(joinedload_all('orders.items.keywords')).order_by('user.orders.items.keywords.name') Tried this above but didn't work. Searched for some sample/tutorials but with n

Re: [sqlalchemy] Re: Simple Queries as ORM classes

2010-10-22 Thread Marc Munro
On Fri, 2010-10-22 at 17:07 -0700, Michael Bayer wrote: > > On Oct 22, 6:58 pm, Marc Munro wrote: > [ dumb question deleted ] > why not map a class to your view/table/select statement in the normal > fashion ? > > tables: > http://www.sqlalchemy.org/docs/orm/tutorial.htm

[sqlalchemy] Simple Queries as ORM classes

2010-10-22 Thread Marc Munro
but session.Query does not want to play nice with me. The only idea I have right now is to define a new Query object which can figure out if its been called for a SimpleQuery and take appropriate action. That seems really sucky though. Anyone have any better ideas? Better yet, has anyone done thi

[sqlalchemy] Re: From sqlalchemy 0.5 to 0.6

2010-06-07 Thread Marc Pfister
ostgresql I ran into the same error trying to build a Windows executable with py2exe. I fixed it by explicitly importing the postgresql dialect and psycopg2: from psycopg2 import * from sqlalchemy.dialects.postgresql import * -Marc -- You received this message because you are subscribed to the G

[sqlalchemy] "business object" backend

2007-10-23 Thread jean-marc pouchoulon
hello all, We are using "business object" , a decisionnal layer upon our databases. I can connect to BO backend with odbc and execute sql order. is SQLAlchemy is able to connect to an ODBC driver other than MSSQL driver? I try also with mysql odbc driver unsuccessfully. thanks for your answ

[sqlalchemy] simple question on select_by with datetime object end mysql

2007-10-10 Thread jean-marc pouchoulon
helo SQLAlchemylist, I want to purge my mysql database and delete record selected by date with a select_by In [56]: query_etats.selectfirst().create_date Out[56]: datetime.datetime(2007, 7, 31, 17, 24, 32) In [57]: madate Out[57]: datetime.datetime(2007, 8, 21, 18, 33, 9, 542421) In [58]: pr

[sqlalchemy] Re: SQLAlchemy 0.4 beta5 (OperationalError) database table is locked '\nDROP TABLE os' () sqlite 3.4.2

2007-09-14 Thread jean-marc pouchoulon
j > Here you're holding onto open cursors with 'something == > ordinateurs.fetchone()'. Either explicitly close() the two result sets > you're accessing with fetchone() or remove your reference to the rows > and python gc will get around to closing the cursors at some point. > > ok thanks.

[sqlalchemy] SQLAlchemy 0.4 beta5 (OperationalError) database table is locked '\nDROP TABLE os' () sqlite 3.4.2

2007-09-14 Thread jean-marc pouchoulon
helo, I don't understand why my sqlite database is locked on a drop ( the code is following) thanks for your explanation. 007-09-14 18:26:36,375 INFO sqlalchemy.engine.threadlocal.TLEngine.0x..f0 ROLLBACK Traceback (most recent call last): File "C:\Python25\Lib\site-packages\pythonwin\pywin