Re: [sqlalchemy] Invalidated Collection

2021-02-04 Thread Christian Henning
Thanks, Mike! I have some studying to do... On Wednesday, February 3, 2021 at 6:42:17 PM UTC-5 Mike Bayer wrote: > > > On Wed, Feb 3, 2021, at 6:23 PM, Christian Henning wrote: > > Hi Mike, > > thanks for your advice! I'll make the changes. > > But let me ask you one t

Re: [sqlalchemy] Invalidated Collection

2021-02-03 Thread Christian Henning
e anything in the documentation? Thanks, Christian On Wednesday, February 3, 2021 at 5:12:30 PM UTC-5 Mike Bayer wrote: > the session.commit() method expires all attributes by default: > > https://docs.sqlalchemy.org/en/13/orm/session_basics.html#committing > > your code is or

[sqlalchemy] Invalidated Collection

2021-02-03 Thread Christian Henning
hemy for 1.3.18 and 1.4.0b1. I'm using python 3.9.1 When I rewrite the last few lines a bit the warning disappears. For instance: jack = User.create(session) a = Address.create(session) jack.addresses.append(a) Any insight is appreciated. I'm still learning. Thanks, Christian -- SQLAlchemy

Re: [sqlalchemy] Mixins and lazy (query) attributes

2019-06-06 Thread Christian Barra
Il giorno mercoledì 5 giugno 2019 18:17:48 UTC+2, Mike Bayer ha scritto: > > > > On Wed, Jun 5, 2019, at 12:02 PM, Christian Barra wrote: > > Hi, I am trying to understand what the best approach is to have lazy > attributes defined on a mixin and then used them on the su

[sqlalchemy] Mixins and lazy (query) attributes

2019-06-05 Thread Christian Barra
Hi, I am trying to understand what the best approach is to have lazy attributes defined on a mixin and then used them on the subclasses. Ideally I'd would like to defer the load of that attribute (controller) and use `undefer` when I know that that attribute is needed, to execute only one

Re: [sqlalchemy] reflecting mysql view

2019-02-14 Thread christian . tremel
Simon, thank you for your kind help. working excerpt: Base = declarative_base() engine = create_engine(app.config.get('SQLALCHEMY_DATABASE_URI')) metadata = MetaData(bind=engine) Base.metadata = metadata # load tables metadata.reflect(autoload=True) # load view, as standard reflection ignores

Re: [sqlalchemy] reflecting mysql view

2019-02-14 Thread christian . tremel
i fiddled around with this. here are some interessting perceptions. defining the primary_key manually yields this, which is totally irrational to me. the missing view that i am after is already defined somewhere? p... >>> my_view = Table("web_view", metadata, Column("NODE_ID", Integer,

Re: [sqlalchemy] reflecting mysql view

2019-02-13 Thread christian . tremel
maybe a "primary key" issue? from the docs: sually, it’s desired to have at least a primary key constraint when reflecting a view, if not foreign keys as well. View reflection doesn’t extrapolate these constraints. Use the “override” technique for this, specifying explicitly those columns

Re: [sqlalchemy] reflecting mysql view

2019-02-13 Thread christian . tremel
ok, so we are back to the central question. the output below indictates that only "tables" are reflected and "views" are ignored. i like to think i am not the first who wants to use mysql views with sqla? is this really such a difficult task? >>> print(Base.classes.keys()) ['attribs',

Re: [sqlalchemy] reflecting mysql view

2019-02-13 Thread christian . tremel
did not work out very well,...god, this stuff gives some good headache! >>> from sqlalchemy.ext.automap import automap_base >>> Base = automap_base(metadata=metadata) >>> Base.prepare() >>> WebView = Base.classes.web_view Traceback (most recent call last): File "", line 1, in File

[sqlalchemy] reflecting mysql view

2019-02-13 Thread christian . tremel
i already spent 3 days trying to map one stupid mysql view and i cant get it to work. in the python interpreter it works... Python 2.7.5 (default, May 31 2018, 09:45:54) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Re: [sqlalchemy] Error while using return_defaults with insert

2017-03-21 Thread Christian Barra
= await result.scalar() Il giorno mercoledì 15 marzo 2017 14:37:29 UTC+1, Mike Bayer ha scritto: > > that's not SQLAlchemy, you're using this: > > https://github.com/aio-libs/aiopg/blob/master/aiopg/sa/result.py#L205 > > > > > On 03/15/2017 04:13 AM, Christian Barra wro

[sqlalchemy] Error while using return_defaults with insert

2017-03-15 Thread Christian Barra
Hello, I am trying to fetch the result of a query after an insert. SQLAlchemy 1.16 and PostgreSQL 9.6 This is the code: engine = self.request.app['db'] async with engine.acquire() as conn: query = models.User.insert().values(email=email, first_name= first_name,

Re: [sqlalchemy] Enum in Array

2017-01-05 Thread Tim-Christian Mundt
d enough. I would not have done the CHECK constraint feature of > enum/boolean by default if it were today it has caused enormous problems. > > On 01/05/2017 09:01 AM, Tim-Christian Mundt wrote: >> That works, thanks. >> >> There is no (easy) way to CHECK the elements of

Re: [sqlalchemy] Enum in Array

2017-01-05 Thread Tim-Christian Mundt
core/type_basics.html?highlight=enum#sqlalchemy.types.Enum.params.create_constraint > > > > On 01/05/2017 01:34 AM, Tim-Christian Mundt wrote: >> Hi, >> >> I've been using an array of enums with postgres and SQLAlchemy >> successfully over the past year like

[sqlalchemy] Enum in Array

2017-01-04 Thread Tim-Christian Mundt
Hi, I've been using an array of enums with postgres and SQLAlchemy successfully over the past year like so: class MyModel(BaseModel): enum_field = Column(postgresql.ARRAY(EnumField(MyEnum, native_enum=False))) The EnumField is from the sqlalchemy_enum34

Re: [sqlalchemy] validate collections

2016-05-21 Thread Tim-Christian Mundt
> Am 11.05.2016 um 17:38 schrieb Mike Bayer <mike...@zzzcomputing.com>: > > On 05/11/2016 03:39 AM, Tim-Christian Mundt wrote: >> Ok, a complete MCVE looks like that: >> >> >> from sqlalchemy import Column, ForeignKey, Integer, S

Re: [sqlalchemy] validate collections

2016-05-11 Thread Tim-Christian Mundt
.tags collection storing two > TagAssociation objects when you've explicitly set the collection to store a > single TagAssociation I don’t get it, where do I set that? > Am 05.05.2016 um 23:26 schrieb Mike Bayer <mike...@zzzcomputing.com>: > > > > On 05/03/2016 06:28

[sqlalchemy] validate collections

2016-05-03 Thread Tim-Christian Mundt
I have entities which I’d like to tag with tags from a vocabulary. The associations between entities and tags are implemented with „manual M:N“, because they carry more information. class Entity(Base): id = Column(Integer, primary_key=True) tags = relationship('TagAssociation',

[sqlalchemy] Re: transaction spanning multiple threads

2015-02-18 Thread Christian Lang
, all three are committed, otherwise all three are rolled back (which is essentially a two-phase commit protocol). However, the zope solution is more generic and will come in handy in less specialized scenarios. Thanks, Christian -- You received this message because you are subscribed

[sqlalchemy] transaction spanning multiple threads

2015-02-17 Thread Christian Lang
for such multi-thread transactions? Thanks in advance, Christian -- 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] Migration from 0.5 to 0.9, legacy code and InvalidRequestError: This transaction is inactive

2014-09-10 Thread christian . h . m . schramm
Am Dienstag, 9. September 2014 18:12:26 UTC+2 schrieb Jonathan Vanasco: What do you see if you drop SqlAlchemy's logging to DEBUG? I think I had a similar problem a long time ago, migrating from 0.5 to 0.8. In my case, the issue was with the `Session` factory -- i was not properly

[sqlalchemy] Migration from 0.5 to 0.9, legacy code and InvalidRequestError: This transaction is inactive

2014-09-09 Thread christian . h . m . schramm
in advance, Christian -- 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 to this group, send email to sqlalchemy

[sqlalchemy] Strange bevahvior with Association Object - Explanation?

2014-04-05 Thread Christian Kastner
software, entity os, assoc runs_on). What I currently do is iterate over the associations of the parent and remove the matched child, but that seems inefficient. Christian (re-submitted because apparently being subscribed to the ML is required to post to i) -- You received this message because you

Re: [sqlalchemy] Strange bevahvior with Association Object - Explanation?

2014-04-05 Thread Christian Kastner
On 2014-04-05 16:58, Michael Bayer wrote: On Apr 5, 2014, at 8:14 AM, Christian Kastner debian.kvr...@gmail.com wrote: I have a many-many relationship implemented as an Association Object. When I add an association between a parent and a child, the list of associations within the parent

Re: [sqlalchemy] Session remove/close MySQL

2014-02-12 Thread Christian Démolis
Thx all NullPool solve my problem create_engine(cnx_str, poolclass=NullPool) 2014-02-07 19:11 GMT+01:00 Claudio Freire klaussfre...@gmail.com: On Fri, Feb 7, 2014 at 2:35 PM, Michael Bayer mike...@zzzcomputing.com wrote: The connection pool, if in use, will then not actually close the

[sqlalchemy] Session remove/close MySQL

2014-02-07 Thread Christian Démolis
Hi all, Actually, i have some problem closing my session... I tried using scopedsession with session.remove I tried using normal session with session.close But in both cases, the Mysql session stay open. Why closing session has no effet on current Mysql connections ? -- You received this

[sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
, in _unsupported_impl NotImplementedError: Operator 'getitem' is not supported on this expression It seems getitem should be allowed since the xpath expression returns an array of nodes (and it is fine in PostgreSQL). Any idea what I am doing wrong and how to fix it? Thanks, Christian -- You

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
sqlalchemy import func, String from sqlalchemy.dialects import postgresql print func.xpath('something', 'somethingelse', type_=postgresql.ARRAY(String()))[1].compile(dialect=postgresql.dialect()) xpath(%(xpath_1)s, %(xpath_2)s)[%(xpath_3)s] On Dec 5, 2013, at 3:33 PM, Christian Lang christia

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
://scott:tiger@localhost/test, echo=True) idx.create(e) the SQL itself still fails on PG (not familiar with the xpath function) but it renders: CREATE INDEX doc_idx ON xmltable (CAST(xpath('//@bla', doc)[1] AS TEXT)) On Dec 5, 2013, at 4:47 PM, Christian Lang christia...@gmail.comjavascript

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
( '//@bla', xmlTable.c.doc, type_=postgresql.ARRAY(String()) ))[1], TEXT) ) On Dec 5, 2013, at 5:20 PM, Christian Lang christia...@gmail.comjavascript: wrote: I see, thanks for clarifying. I think

[sqlalchemy] Many to many relationship with a composite key

2013-03-07 Thread Christian
Let's say I have the following model: class Molecule(Base): db = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True) data = Column(Integer) class Atom(Base): id = Column(Integer, primary_key=True) weight = Column(Integer) And I want to establish a

[sqlalchemy] Re: Many to many relationship with a composite key

2013-03-07 Thread Christian
', 'molecule.id') ),) And add the relatiohship to one of the models as usual, for example, in Class Atom add: molecules = relationship(Molecule, secondary=molecule2atom, backref=atoms) On Thursday, March 7, 2013 10:16:24 AM UTC+1, Christian wrote: Let's say I have the following model: class

[sqlalchemy] twophase error sqlalchemy

2013-02-20 Thread Christian Démolis
Hi, AttributeError: 'NoneType' object has no attribute 'twophase' 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. Session already has a Connection associated for the given Connection's Engine) else: conn =

Re: [sqlalchemy] Object state after session.delete(obj)?

2013-02-02 Thread Christian Theune
, although marked for deletion, the objects still have all of their state, including working references. So … what's your take on that? :) Christian -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving

[sqlalchemy] Object state after session.delete(obj)?

2013-02-01 Thread Christian Theune
a session. If you run the attached code with SQLAlchemy (0.7 or 0.8) then the object stays alive, stays attached and the application can't see that it has been deleted. Is this intentional? Am I holding it wrong? Thanks, Christian -- You received this message because you are subscribed to the Google

[sqlalchemy] Using Oracle Indexes...

2012-05-30 Thread Christian Klinger
i check if the index is used in a select? Do i see it with echo=True? Thanks in advance... Christian -- 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

[sqlalchemy] Optimize and SqlAlchemy

2012-03-30 Thread Christian Démolis
Hi all, I have a very strange problem... I have an application which runs under SQL Alchemy. When my application is running and i launch OPTIMIZE TABLE in PhpMyAdmin, my process blocks showing this error Waiting for metadata lock When i close my application, the process unlocks. What happen in

Re: [sqlalchemy] Re: Association Proxy append a new item to relationship in same way as classic many to many relationship

2012-03-28 Thread Christian Démolis
the same behaviour that classic many to many relationship ? I already try adding : creator=lambda x: x to my association proxies* 2012/3/27 Michael Bayer mike...@zzzcomputing.com On Mar 27, 2012, at 4:35 AM, Christian Démolis wrote: Up! 2012/3/23 Christian Démolis christiandemo...@gmail.com

[sqlalchemy] Association Proxy append a new item to relationship in same way as classic many to many relationship

2012-03-23 Thread Christian Démolis
Hi all, class A(Base): __tablename__ = 'a' IdA = Column('IdA', Integer, primary_key=True) AllTheB = association_proxy(many_to_many_relation, relation_b) class ManyToManyRelation( __tablename__ = 'many_to_many_relation' IdA = Column(Integer, ForeignKey('A.IdA'),

Re: [sqlalchemy] Re: Handle many to many relationship

2012-03-19 Thread Christian Démolis
(articke) object and you save it ! PS: tarife ou tarif ? On Thursday, March 15, 2012 12:38:26 PM UTC+1, Christian Démolis wrote: Hi all, DossierTarife = Table('tarifer_dossier', Base.metadata, Column('IdDossier', Integer, ForeignKey('dossier.IdDossier'**)), Column('IdAt

Re: [sqlalchemy] Overload Query Object

2012-02-01 Thread Christian Démolis
Hi, right, it's that thanks 2012/1/31 Tate Kim insight...@gmail.com ** Hi, Have you checked the __iter__ method ? -- *From: * Christian Démolis christiandemo...@gmail.com *Sender: * sqlalchemy@googlegroups.com *Date: *Tue, 31 Jan 2012 17:39:54 +0100

[sqlalchemy] Overload Query Object

2012-01-31 Thread Christian Démolis
Hi Michael, i overload class Query in my script. i have 4 ways to obtain query's results. 1/ session.query(model.x).all() 2/ session.query(model.x).first() 3/ session.query(model.x).one() 4/ for e in session.query(model.x): print e in case 1,2,3, i know which method is used What method

[sqlalchemy] Alter a Sequence after creation...

2011-07-14 Thread Christian Klinger
= create_engine(DSN, echo=True) Base.metadata.create_all(engine) event.listen(SomeClass, after_create, DDL('ALTER SEQUENCE some_table_seq NO_CACHE')) But this does not work. What should i add instead of SomeClass? Thanks in advance Christian -- You received this message because you are subscribed

[sqlalchemy] Re: SA and IBM DB2

2011-07-07 Thread Christian Klinger
Hi Michael, thanks for input. If i find some time i will start... Christian On Jul 6, 2011, at 11:19 AM, Christian Klinger wrote: Hi Michael, i am intrested in writing a dialect for DB2. Is there any howto which covers what is needed to start. Do you think we should write an extension

[sqlalchemy] Re: SA and IBM DB2

2011-07-06 Thread Christian Klinger
Hi Michael, i am intrested in writing a dialect for DB2. Is there any howto which covers what is needed to start. Do you think we should write an extension, or should this dialect in sqlalchemy itself? Thanks in advance Christian On Jun 29, 2011, at 6:43 AM, Luca Lesinigo wrote: Hello

[sqlalchemy] How to write and access attribute in many to many table

2011-03-14 Thread Christian Démolis
Hi all, I have a question about many to many Table containing attribute. How to access and write Max attribute in many to many table ? I already read that but i try to not use mapper and stay in declarative mode which is more user friendly :)

Re: [sqlalchemy] Attach a string to each results of a query

2010-12-10 Thread Christian Démolis
Okay it works literal() and literal_column() functions works with sqlite but only literal() function works with MySQLdb connector Thanks a lot !) 2010/12/9 Michael Bayer mike...@zzzcomputing.com On Dec 9, 2010, at 11:14 AM, Christian Démolis wrote: Could not locate column in row for column

[sqlalchemy] Attach a string to each results of a query

2010-12-09 Thread Christian Démolis
Hi, SELECT IdActe, coucou FROM `acte` WHERE 1 How to attach a string to each result of a query ? i try that but it doesn't work :( s = model.session.query(milieu, model.Dossier.NomEntreprise, model.Dossier.AgendaSensGroupement, model.Dossier.AgendaUnite, *Coucou*) Thx Chris -- You

[sqlalchemy] Strange behaviour with func.timediff?

2010-11-18 Thread Christian Démolis
Hi, I found a usecase that is illogical Here is the first code and his result in term. All is *False* milieu = model.aliased(model.Plage) s2 = model.session.query( milieu, model.func.timediff(milieu.Fin, milieu.Debut), *model.func.timediff(milieu.Fin,

Re: [sqlalchemy] Strange behaviour with func.timediff?

2010-11-18 Thread Christian Démolis
strings and Python constructs to cursor.execute(). On Nov 18, 2010, at 5:04 AM, Christian Démolis wrote: Hi, I found a usecase that is illogical Here is the first code and his result in term. All is *False* milieu = model.aliased(model.Plage) s2 = model.session.query

[sqlalchemy] TIMEDIFF and SQLAlchemy

2010-11-17 Thread Christian Démolis
Hi, Do you know how to do this query with sqlalchemy? *SELECT Id, TIMEDIFF( End, Start) FROM plage WHERE TIMEDIFF(End,Start)=TIME('02:20:00');* In my model, Start and End are DateTime Start = Column('Start', DateTime) End = Column('End', DateTime) -- You received this message because you are

Re: [sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)

2010-10-15 Thread Christian Démolis
Thanks 2010/10/14 Michael Bayer mike...@zzzcomputing.com On Oct 13, 2010, at 10:48 AM, Christian Démolis wrote: Hi, q = model.session.query( # model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None

[sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)

2010-10-12 Thread Christian Démolis
Hello, I actually try to migrate to SqlAlchemy 0.6.4 (before i was in 0.5.2) One of my query seems to not work properly in this new version It seems to be a bug in Sql Alchemy because of this part of my query *model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(),

Re: [sqlalchemy] Sql Alchemy non Transactionnal

2010-09-21 Thread Christian Démolis
...@zzzcomputing.com On Sep 20, 2010, at 10:37 AM, Christian Démolis wrote: Hi, Can i use SqlAlchemy in a non transactionnal way ? How can i do it? Session() has an autocommit=True flag that will commit every flush() operation immediately and not retain an open transaction during usage. You may

[sqlalchemy] Oracle Views/DatabaseLink and declarative

2010-02-24 Thread Christian Klinger
BTeilnehmer with: BaseC.metadata.create_all(engine) it gives me this traceback: So any ideas or suggestions. Thanks for your help Christian yeti:fernlehrgang cklinger$ bin/python create.py 2010-02-24 10:05:59,090 INFO sqlalchemy.engine.base.Engine.0x...3c10 SELECT USER FROM DUAL 2010-02-24 10:05

Re: [sqlalchemy] Filter on relation???

2009-11-25 Thread Christian Démolis
Ok, i already use session.query, no problem with my code. It works very well at the moment. I m just curious about advanced functionnality of my favourite orm :) Thanks to you, i have discovered that we can : - define associationproxy - define a properties which returns the result of a

[sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
Is it possible to put a filter on a relation in the declaration? Example : LeNomDuUtilisateur = relation(Utilisateur, filter_by=Utilisateur.Login, backref=backref('verrouillage')) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
:18 +0100, Christian Démolis pisze: Is it possible to put a filter on a relation in the declaration? Example : LeNomDuUtilisateur = relation(Utilisateur, filter_by=Utilisateur.Login, backref=backref('verrouillage')) I'm not sure what exactly your example means.. but if you want extra

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
Cool, it's very powerful, it will allow me to save my Bandwidth because i take just what i want and not the entire object. Thanks Conor 2009/11/24 Conor conor.edward.da...@gmail.com Christian Démolis wrote: Thx for your answer Thomas I want the attribute to not return the complete object

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
i bind the relation to the light object It s a brutal method, i dont think if it can work... 2009/11/24 Conor conor.edward.da...@gmail.com Christian Démolis wrote: Cool, it's very powerful, it will allow me to save my Bandwidth because i take just what i want and not the entire object

[sqlalchemy] Re: problem with like

2009-10-14 Thread Christian Démolis
conor.edward.da...@gmail.com wrote: Christian Démolis wrote: Hi, The idea of creating another column is good but it will multiplicate the size of my table by 2 for nothing. Is it possible to use MYSQL regular expression search with sql alcmehy? If yes, what is the command? MySQL

[sqlalchemy] Re: problem with like

2009-10-12 Thread Christian Démolis
. Cheers, Andre On Fri, Oct 9, 2009 at 5:46 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I m stuck with a query about telephone number : I want to find in my database all the contact who have a telephone number. The difficulty is that some number

[sqlalchemy] Documentation please

2009-10-12 Thread Christian Démolis
Hello, class sqlalchemy.sql.expression.ColumnOperators¶ Defines comparison and math operations. __init__()¶ x.__init__(...) initializes x; see x.__class__.__doc__ for signature asc()¶ between(cleft, cright)¶ collate(collation)¶ concat(other)¶ contains(other,

[sqlalchemy] problem with like

2009-10-09 Thread Christian Démolis
Hi everybody, I m stuck with a query about telephone number : I want to find in my database all the contact who have a telephone number. The difficulty is that some number in the database can have space or . between numbers example : 06.06.50.44.11 or 45 87 12 45 65 This my query with like but

[sqlalchemy] Re: Orm slow to update why?

2009-10-02 Thread Christian Démolis
Update 1000 SqlAlchemy 31.0309998989 It s crazy ^^ I don t know why my station is slow? Do u have an idea?* 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just

[sqlalchemy] Re: Orm slow to update why?

2009-10-02 Thread Christian Démolis
I does a mistake in my last, that is the results (error in parameters of mysqldb connection) Local database Update 1000 MySQLdb 0.0319998264313 Update 1000 SqlAlchemy 0.265999794006 France-Tunisia Update 1000 MySQLdb 10.391324 Update 1000 SqlAlchemy 42.157924 Sorry 2009/10/2 Christian

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
With ORM pure SQL 0.3123624 With MySQLdb without ORM 0.0940001010895 2009/9/30 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: Thx for your answer. MakeReleased is a method of com object windows agent (self.agent = DispatchWithEvents('CosmoAgent.clsCCAgent', Evenement

[sqlalchemy] Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Hi again, Is there any way to avoid checking database structure during the metadata.create_all declaration's phase? It can be good to check when we are in test phase but when we are in production and we are sure of our model, it can be good to bypass create_all checking to database.

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
\teloignement VARCHAR, \n\turl VARCHAR, \n\tPRIMARY KEY (`IdVil le`)\n)\n\n' () 2009/10/1 King Simon-NFHD78 simon.k...@motorola.com -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Christian Démolis Sent: 01 October 2009 10:40

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Ok, i just realize that create_all is useless when database already exist. Starting my application is 6 seconds faster now. Thanks all 2009/10/1 limodou limo...@gmail.com On Thu, Oct 1, 2009 at 6:25 PM, Christian Démolis christiandemo...@gmail.com wrote: Thx Simon, I tried

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
sqlalchemy.engine.base.Engine.0x...7f50 [0, 1L] 2009-10-01 17:00:38,743 INFO sqlalchemy.engine.base.Engine.0x...7f50 COMMIT With ORM force update 0.45368665 2009/10/1 Michael Bayer mike...@zzzcomputing.com Michael Bayer wrote: Christian Démolis wrote: Hello, I tried all the method to compare

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just did a test on internet in Tunisia, 39kbits/sec upload and 417kbits/sec 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: With debug mode it seems to take 0.15

[sqlalchemy] Orm slow to update why?

2009-09-29 Thread Christian Démolis
i made a test i did that without sql alchemy orm: import MySQLdb import time # Establich a connection db = MySQLdb.connection(host=192.168.45.28, user=apm, passwd=apm, db=test_christian) # Run a MySQL query from Python and get the result set xref

[sqlalchemy] session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Hi everybody, I have a little problem with session.query. I try to optimize my queries with only attributes that i need. When we impose attribute, sqlalchemy return a rowtuple s = session.query(IdFile, NameFile) When we don't impose attribute, the return is the object s = session.query(File) Is

[sqlalchemy] Re: session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Ok thanks 2009/9/28 Mike Conley mconl...@gmail.com The column is available as e.Namefile, no need to subscript with numbers. On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I have a little problem with session.query. I try

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-18 Thread Christian Démolis
session.query behavior without change the code of sqlalchemy itself, please help me. 2009/9/17 Michael Bayer mike...@zzzcomputing.com Alexandre Conrad wrote: Christian, 2009/9/17 Christian Démolis christiandemo...@gmail.com: Bonjour, Tu es français je pense au vu de ton prénom. Je

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-18 Thread Christian Démolis
...@gmail.com In Python, you have to pass self as first argument to all methods of a class: class MyQuery(sqlalchemy.orm.query.Query): def __init__(self, *arg, **kw): ... Alex 2009/9/18 Christian Démolis christiandemo...@gmail.com: Hello, Thx for the answer, thx to Alexandre

[sqlalchemy] SQL ALCHEMY instantly refresh

2009-09-17 Thread Christian Démolis
How can i force sqlalchemy to refresh an object when i did a session.query??? Sqlalchemy seems to work with a cache, i want to deal with it. Nota : i use sqlalchemy in non transactional mode Session = scoped_session(sessionmaker(autocommit=True, bind=engine))

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-17 Thread Christian Démolis
query de sqlalchemy mais je n'ai pas réussi... J'ai trouvé ce lien qui est intéressant mais je n'ai pas réussi à l'exploiter : http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery 2009/9/17 Alexandre Conrad alexandre.con...@gmail.com 2009/9/17 Christian Démolis christiandemo

[sqlalchemy] Re: MySQL DDL broken with autoincrement-column in multipart-key using InnoDB

2009-08-06 Thread Christian Schwanke
in the SQLA-schema-defintion was set to False and SQLA will probably not examine the database's metadata in order to find out which column is autogenerated :-) So to make a long story short: with autoincrement=True, the 0.6 branch and the fixed mysql dialect, everything works as expected. Christian On 4

[sqlalchemy] MySQL DDL broken with autoincrement-column in multipart-key using InnoDB

2009-08-04 Thread Christian Schwanke
I'm using MySQL and want to use a combined primary-key where the second column is autogenerated while the first part is an assigned value. This is how my Table-definition looks like: table_a = Table('table_a', metadata, Column('assigned_id', Integer(), primary_key=True, autoincrement=False),

[sqlalchemy] Re: MySQL DDL broken with autoincrement-column in multipart-key using InnoDB

2009-08-04 Thread Christian Schwanke
and the ID is then correctly set during flush, this is not a show stopper but it seems to me, that in the 0.6 version, the autoincrement flag does affect more than the DDL generation. Anyways, thanks for your help and effort! Christian --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-08-03 Thread Christian Schwanke
Hi Michael, thanks for your effort, glad to hear that the issue is resolved! On 1 Aug., 02:37, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 31, 2009, at 7:20 PM, Michael Bayer wrote: I will investigate a way such that the dialect more intelligently selects the primary key column

[sqlalchemy] Problems with composite primary key and nested relations

2009-07-30 Thread Christian Schwanke
Hi, I've ran into a problem when using a composite primary key with auto_incremented values and nested relations. My scenario is as follows: I have three models A, B and C, where A has a one-to-many relation to B and B has a one-to-many relation to C. A has a standard primarykey consisting of

[sqlalchemy] Re: Python 3.0

2008-11-16 Thread Christian Heimes
to port SA to 3.0 you have to * wait until 2.6.1 is released. 2to3 in 2.6.0 is broken and breaks on SA 0.5rc2 * get SA working on 2.6.1 * get SA working on 2.6.1 with the -3 warning options w/o triggering a warning * run 2to3 and pray ;) Christian