[sqlalchemy] Re: Composite Association Proxies - values of dict are not deleted in DB when keys are deleted

2018-10-28 Thread Sven
Indeed, in my case, it's smarter to put the keys and values in the same table. I tried this and it seems to works fine: from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.orm import relationship, backref, Session from sqlalchemy.ext.associationproxy import

[sqlalchemy] Composite Association Proxies - values of dict are not deleted in DB when keys are deleted

2018-10-26 Thread Sven
- "v1" 2 - "v2" Is it possible to configure SQLAlchemy in order to also delete the values of the dictionary from the database when the keys are deleted? I don't know if it can explains something but I am using PostgreSQL. Thank you for your help! Sven -- SQLAl

[sqlalchemy] Re: Generic Associations - table_per_association: parent attribute

2018-07-28 Thread Sven
Hi Mike, Ok, let's forget everything I said before, it is too confusing. I propose to start from the *table_per_association* example: http://docs.sqlalchemy.org/en/latest/_modules/examples/generic_associations/table_per_association.html Would it be possible to have an attribute

[sqlalchemy] Re: Generic Associations - table_per_association: parent attribute

2018-06-24 Thread Sven
Hello, Any idea regarding my problems ? Thank you ! Sven -- 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 Example. See http://stackoverflow.com/help/mcve

[sqlalchemy] Re: Generic Associations - table_per_association: parent attribute

2018-06-10 Thread Sven
a). Indeed, a player can get objects from a chest and hold them in Hands. I can't store Hands.Object into ObjectContainer.objects which would be only supposed to contain ObjectContainer.Object instances... Thank you very much. Sven -- SQLAlchemy - The Python SQL Toolkit and Object Relatio

[sqlalchemy] Generic Associations - table_per_association: parent attribute

2018-05-31 Thread Sven
arent attribute of *Object* linked to *Hands* but I don’t need to have any list of the objects in *Hands*. Of course, I could ignore that and let the list be created but it’s a bit dirty I assume that the answers are pretty simple but I think my comprehension of the “secondary” parameter

Re: [sqlalchemy] Re: Relationships - crash when class instantiation

2018-02-26 Thread Sven
Thank you Mike, it works ! Le samedi 24 février 2018 16:35:57 UTC+1, Mike Bayer a écrit : > > On Sat, Feb 24, 2018 at 5:33 AM, Sven <sven@gmail.com > > wrote: > > Hello, > > > > I have now a small example which illustrates the problem. > > >

[sqlalchemy] Re: Relationships - crash when class instantiation

2018-02-07 Thread Sven
Thank you Mike. I'll try that :-) I'll keep you informed. -- 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 Example. See http://stackoverflow.com/help/mcve for a

Re: [sqlalchemy] Relationships - crash when class instantiation

2018-02-07 Thread Sven
problem you describe and then post an example > code : http://stackoverflow.com/help/mcve. > > Regards > Gaston > > > > Le 07/02/2018 à 12:09, Sven a écrit : > > Hello everybody, > > Today, I have a strange problem regarding relationships. > > My projec

[sqlalchemy] Relationships - crash when class instantiation

2018-02-07 Thread Sven
nfinite Loops ? Has someone already see that ? How could I learn more about the problem and figure out what SQLALchemy is trying to do and where it crashes ? Thank you. Sven -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code

[sqlalchemy] Re: Dictionaries with mapped objects as keys and integers as values

2017-11-30 Thread Sven
It works admirably well. Again, thank you very much for the support you provide. -- 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 Example. See

[sqlalchemy] Dictionaries with mapped objects as keys and integers as values

2017-11-29 Thread Sven
Hello everybody, Is it possible to map dictionaries whose keys are objects and the values simple integers? I have the following case : *In the program, there is one instance of "Options" which contains a dictionary. This dictionary has players as keys and integers as values. These integers

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-09 Thread Sven
Thank you for your answers and your explanations ! :-) It is clear to me, now and I will work on that. -- 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 Example. See

Re: [sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Sven
What do you mean by "deduplication" ? I have certainly just a few exotic different type of collection. The others are standard (lists, dictionaries, ordereddict, etc), but I don't understand why you are asking that :p Are you asking that because you think that the solution would be to always

[sqlalchemy] Is it a bad idea to avoid to use backref and back_populates ?

2017-11-08 Thread Sven
at it should not append something which was already inserted ? Thank you very much ! Regards, Sven -- 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 Example.

[sqlalchemy] Relationship: OrderedDict - errors when None values

2017-11-06 Thread Sven
ind=engine) session = Session() south = Exit("south") west = Exit("west") e = Exits() e.exits["south"] = south e.exits["west"] = west session.add(south)

[sqlalchemy] Re: SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven
Exactly what I was looking for and it works (even applied to my project). I tried so many things these last days and the solution now looks so simple. Thank you very much ! -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

Re: [sqlalchemy] SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven
bsolutely clear for me for now. This is the first time I use SQLAlchemy. Do you think that this method is possible and is the right way to proceed ? Le vendredi 20 octobre 2017 20:02:40 UTC+2, Mike Bayer a écrit : > > > CONTINUING ! sorry > > > On Fri, Oct 20, 2017 at 11:55 A

[sqlalchemy] Re: SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven Dumay
Version of Python : 3.4.0 Version of SQLAlchemy : 1.2.0b2 -- 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 Example. See http://stackoverflow.com/help/mcve for a

[sqlalchemy] SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven Dumay
(jean.name) Here is what I get : >>> Traceback (most recent call last): File "C:\Users\Sven\Desktop\SQL Alchemy Tests\test2.py", line 10, in class Stockable(metaclass = MetaBase): File "C:\Users\Sven\Desktop\SQL Alchemy Tests\test2.py", line 7, in __init_

Re: [sqlalchemy] Column order with declarative base

2014-12-30 Thread Sven Teresniak
).get( (keypart3, keypart2, keypart1) ) which means: I have to change my code every time the ordering of elements in Python's dictionary changes. Best wishes for 2015 Sven -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] Re: Column order with declarative base

2014-12-30 Thread Sven Teresniak
-orders my primary composite key parts accordingly? Thanks Sven -- 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 to sqlalchemy+unsubscr...@googlegroups.com. To post

Re: [sqlalchemy] Re: Column order with declarative base

2014-12-30 Thread Sven Teresniak
Aaah Michael, thanks! This is awesome! I tried a lot and all the time I felt that I missed exact this kind of easy answer. ;) Thanks again. Will implement this now. Sven Am Dienstag, 30. Dezember 2014 17:01:14 UTC+1 schrieb Michael Bayer: why don’t you set up your PrimaryKeyConstraint

[sqlalchemy] Autoload=True and schema changes

2010-10-11 Thread Sven A. Schmidt
Hi, I've got an issue which pops up from time to time with an SQLAlchemy based webservice application and it revolves around schema changes happening while an engine with autoload=True has been instantiated and is being used to start sessions. What happens is that someone on the team will make a

[sqlalchemy] Re: Autoload=True and schema changes

2010-10-11 Thread Sven A. Schmidt
a column when there's no DDL change to the table? I should really try and reproduce the problem first in a controlled environment to be sure I'm isolating the correct problem. Cheers, Sven On Oct 11, 6:12 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 11, 2010, at 11:17 AM, Sven A. Schmidt

[sqlalchemy] Re: MySQL DATE_ADD function

2010-10-05 Thread Sven A. Schmidt
Hi Bryan, the only tricky bit in your SQL is the dangling 'DAY', because there's no operator to tie it to the rest. Otherwise you should be able to write (schema.AppDcRpe2 is just a Table object I'm using as an example): q =

[sqlalchemy] Re: Use regexp in like

2010-09-21 Thread Sven A. Schmidt
Michael, I hope I'm not misunderstanding what your trying to achieve, but isn't a combination of like and not like want you want to do here? As in: create table test ( t varchar2(255) ); insert into test values ('AA123'); insert into test values ('A0123'); select * from test where t like 'A%'

[sqlalchemy] Re: DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Sven A. Schmidt
Just wondering if it's any different if you try the tripe quote syntax For example in a similar case I use q = select os, count(os) from ( select distinct s.id, os from server s join instance_server ins on s.id =

[sqlalchemy] Re: mixed up relationships

2010-08-12 Thread Sven A. Schmidt
Carl, the formatting got a bit messed up but if I read your definition correctly you defined the relation as 'splits'. So you'd want to write trainingEffor.splits (lower case 's' in splits). -sas On Aug 12, 9:20 am, Bleve carl.i.bre...@gmail.com wrote: I'm using SQLAlchemy 0.6.3 on Python 2.6

[sqlalchemy] SAWarning: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2010-08-10 Thread Sven A. Schmidt
but this error looks like something more fundamental may be wrong. Does anyone on this list have an idea what I could try to investigate further? I hope I've included all the relevant infos in this (quite long, sorry!) mail. Let me know if I can provide anything else! Cheers, Sven -- You

[sqlalchemy] Re: SAWarning: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2010-08-10 Thread Sven A. Schmidt
the issue. I'll report back once I know more. Cheers, Sven On Aug 10, 3:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 10, 2010, at 9:28 AM, Sven A. Schmidt wrote: Getting this out of the way first, because I always forget ;) : SQLAlchemy-0.5.5, Python 2.6 I'll take a look

[sqlalchemy] Re: SAWarning: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2010-08-10 Thread Sven A. Schmidt
FKs were in place and I never needed to specify ForeignKey(...) Sorry for the noise, Sven On Aug 10, 4:10 pm, Sven A. Schmidt s...@abstracture.de wrote: Thanks, Michael. I wish I could update to 0.6.3 but unfortunately I'll have to stick with the deployed version of 0.5.5 for now. But in any

[sqlalchemy] Re: Oracle: There are multiple tables visible...

2009-06-24 Thread Sven A. Schmidt
that there is a mismatch between target names and specified names causing this issue.  or maybe the oracle dialect just doesn't interpret the owner part of a foreign key constraint correctly yet (im not easily able to test things like that with Oracle XE). That did the trick! Thanks a lot, Sven

[sqlalchemy] Oracle: There are multiple tables visible...

2009-06-23 Thread Sven A. Schmidt
if that can always be avoided nor if that's too fragile overall. In the end that would mean that by creating extra synonyms for another user a working script could break. Or am I missing something here? Any insight greatly appreciated! :) Cheers, Sven

[sqlalchemy] Re: Oracle: There are multiple tables visible...

2009-06-23 Thread Sven A. Schmidt
= 'AINV_OWNER' on Table(...) Results in the error: Could not determine join condition between parent/child tables... See 2) above. It seems I'm stuck between a rock and a hard place here ;) Cheers, Sven On Jun 23, 5:03 pm, Michael Bayer mike...@zzzcomputing.com wrote: Sven A. Schmidt wrote: Hi

[sqlalchemy] Self Reference within Joined Inheritance

2009-05-23 Thread sven-eric
anyone give me advice for setting up this kind of relation on InnoDB? Thanks a lot. -sven-eric import sqlalchemy from sqlalchemy import create_engine from sqlalchemy import String, Column, Integer, ForeignKey, ForeignKeyConstraint from sqlalchemy.orm import relation, backref from

[sqlalchemy] Polymorphism and single table inheritance

2009-05-20 Thread sven-eric
properly here (the three queries at the end of the provided code all return the same list of objects). I would be grateful if someone could read the short piece of code and give me advice for how to retrieve only the 'Jon Doe' object of the base class with the query. Thanks a lot. -sven import

[sqlalchemy] Re: Polymorphism and single table inheritance

2009-05-20 Thread sven-eric
Alright, I see. I appreciate the quick reply and thanks for all the work you putting in answering these questions. -sven On May 20, 4:45 pm, Michael Bayer mike...@zzzcomputing.com wrote: sven-eric wrote: Dear List,      I have an issue with single table inheritance and sqlalchemy