Re: [sqlalchemy] raise error on insert/update PK?

2018-01-03 Thread Tim Chen
Thanks so much! Really appreciate the example. On Wednesday, January 3, 2018 at 3:46:47 PM UTC-5, Mike Bayer wrote: > > On Wed, Jan 3, 2018 at 1:18 PM, Tim Chen <timc...@gmail.com > > wrote: > > Let's say I'm using a uuid PK for my models with a

[sqlalchemy] raise error on insert/update PK?

2018-01-03 Thread Tim Chen
Let's say I'm using a uuid PK for my models with a ` server_default` set to `gen_random_uuid()` (in PostgreSQL). Is there a way to ensure the server_default value? I would like to catch any INSERT or UPDATE statements that set the PK value and raise an error if possible. -- SQLAlchemy -

Re: [sqlalchemy] creating objects in merge() does not set primary key

2018-01-02 Thread Tim Chen
#sqlalchemy.orm.session.Session.merge On Tuesday, January 2, 2018 at 11:47:06 AM UTC-5, Mike Bayer wrote: > > On Tue, Jan 2, 2018 at 11:44 AM, Tim Chen <timc...@gmail.com > > wrote: > > Hrmm, that's not what I'm getting. Maybe I'm misunderstanding something > - > > here's

Re: [sqlalchemy] creating objects in merge() does not set primary key

2018-01-02 Thread Tim Chen
() session.add(user) session.commit() assert user.id assert user.profile.id test_add() test_merge() On Monday, January 1, 2018 at 9:49:55 PM UTC-5, Mike Bayer wrote: > > On Mon, Jan 1, 2018 at 9:18 PM, Tim Chen <timc...@gmail.com > > wrote: > > When I merge() an o

[sqlalchemy] creating objects in merge() does not set primary key

2018-01-01 Thread Tim Chen
When I merge() an object without a PK, I expect similar behavior to add(), in that the autogenerated PK is returned and set on the object. Is that not expected behavior? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

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
ust an array of varying. I'm ok with that as long as I can use enums in my Python code (e.g. query.filter(enum_field==MyEnum.ONE)) Regards Tim -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and

Re: [sqlalchemy] nested correlated exists subquery ?

2016-07-08 Thread Tim Chen
if that needs help with the correlation then we'd add some correlate() > calls, but it shouldn't, since the FROM nesting here is clear. > On 07/08/2016 03:21 AM, Tim Chen wrote: > > Hi, I'm wondering what the correct syntax is for a nested correlated > > exists subquery? > >

[sqlalchemy] nested correlated exists subquery ?

2016-07-08 Thread Tim Chen
( select 1 from engagement ee where ee.id = 156 and ee.target_id = e.target_id and ee.candidate_id = e.candidate_id ) ); Much appreciated! -tim -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from

[sqlalchemy] Last 2 versions query

2016-06-17 Thread Tim Burgess
I have some working SQL that gets the last two id's (autoincremented) in a TaskRevisons table that has a column that maps to an id in a Tasks table. The SQL is: select task_id, id from TaskRevisions where ( select count(*) from TaskRevisions as t where t.task_id = TaskRevisions.task_id and

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
vent I can use to reliably implement that validation? Thanks, Tim -- 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...@googl

Re: [sqlalchemy] mssql: UnicodeDecodeError: 'utf8' codec can't decode byte

2016-03-09 Thread Tim Pierson
59:44 PM UTC-5, Mike Bayer wrote: > > Can you share a stack trace please ? Encoding operations can occur in > many places and I don't see that identified here. Also this is Python 3? > What OS platform and ODBC driver / configuration as well? If freetds > please share your freetds co

[sqlalchemy] Re: mssql: UnicodeDecodeError: 'utf8' codec can't decode byte

2016-03-04 Thread Tim Pierson
wonder if this situation is recognizable and if anyone has any advice on dealing with the situation? Thanks On Friday, March 4, 2016 at 2:51:15 PM UTC-5, Tim Pierson wrote: > > I've seen a couple of issues regarding mssql and drivers handling of > strings but I haven't been able to r

[sqlalchemy] mssql: UnicodeDecodeError: 'utf8' codec can't decode byte

2016-03-04 Thread Tim Pierson
I've seen a couple of issues regarding mssql and drivers handling of strings but I haven't been able to resolve my problem. I have a flask app with flask-sqlalchemy models defined and a simple query is throwing the above complaint about decoding the string. My connection string:

Re: [sqlalchemy] How to pass a table as a function parameter?

2015-08-22 Thread Tim Radke
? SQLAlchemy doesn't support that. Just use text(), if this is the case. On 8/21/15 11:44 PM, Tim Radke wrote: I'm using SQLAlchemy version 0.9.8, connecting to Postgres 9.4. I'm trying to do something like this: query = select([func.to_json(User)]).select_from(User) # Printing

[sqlalchemy] How to pass a table as a function parameter?

2015-08-21 Thread Tim Radke
I'm using SQLAlchemy version 0.9.8, connecting to Postgres 9.4. I'm trying to do something like this: query = select([func.to_json(User)]).select_from(User) # Printing the query returns something that seems to make sense: # print select([func.to_json(User)]).select_from(User) # SELECT

Re: [sqlalchemy] ValueError from orm/persistance on db.commit()

2015-07-01 Thread Tim Pierson
:00 AM UTC-4, Michael Bayer wrote: On 6/26/15 6:42 PM, Tim Pierson wrote: Hi, I wonder if anyone can help with the below stack-trace. The code in question works perfectly under Windows to MSSQL with the following connection string (params omitted): ENGINE = sa.create_engine

[sqlalchemy] ValueError from orm/persistance on db.commit()

2015-06-26 Thread Tim Pierson
Hi, I wonder if anyone can help with the below stack-trace. The code in question works perfectly under Windows to MSSQL with the following connection string (params omitted): ENGINE = sa.create_engine('mssql://DBSERVER/DB?trusted_connection=yes') but something becomes an array when the

[sqlalchemy] Reflecting Oralce Global Temp Tables Not Possible?

2015-05-15 Thread Tim Ellerton
http://stackoverflow.com/questions/30257643/reflecting-oracle-global-temp-tables-using-pythons-sqlalchemy 0down votefavorite http://stackoverflow.com/questions/30257643/reflecting-oracle-global-temp-tables-using-pythons-sqlalchemy# I am using sqlalchemy and want to reflect the table structure

Re: [sqlalchemy] listening for events on 'mapper'

2015-04-08 Thread Tim Tisdall
Sorry, I just saw the the Mapper class itself and the mapper() function indicate listening for all mappers. on the latest docs. Thanks. On Wed, Apr 8, 2015 at 5:27 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 4/8/15 5:14 PM, Tim Tisdall wrote: I have some code I'm trying to figure out

[sqlalchemy] listening for events on 'mapper'

2015-04-08 Thread Tim Tisdall
I have some code I'm trying to figure out... Here it is: from sqlalchemy import event from colanderalchemy import setup_schema from sqlalchemy.orm import mapper event.listen(mapper, 'mapper_configured', setup_schema) It appears to call `setup_schema` on every ORM class that derives from the

Re: Checking code and database are in sync

2015-02-11 Thread tim . mitchell
. For each foreign key alembic wants to: - remove a foreign key one with table = tablename and - add same foreign key with table = schema.tablename The same is true for unique constraints. Any ideas? Thanks Tim On Tuesday, 10 February 2015 14:05:27 UTC+13, Michael Bayer wrote: tim.mi

Re: Checking code and database are in sync

2015-02-11 Thread tim . mitchell
key with table = schema.tablename The same is true for unique constraints. Any ideas? Thanks Tim On Tuesday, 10 February 2015 14:05:27 UTC+13, Michael Bayer wrote: tim.mi...@leapfrog3d.com wrote: Hi all, I would like to have a post-deployment check that verifies

Re: [sqlalchemy] update where using the ORM

2014-04-28 Thread Tim Kersten
On Saturday, April 26, 2014 9:12:22 PM UTC+1, Michael Bayer wrote: On Apr 26, 2014, at 3:26 PM, Tim Kersten t...@io41.com javascript: wrote: The resulting behaviour would be identical to using a version col id, but only for this transaction and the instance passed to the update_where

Re: [sqlalchemy] update where using the ORM

2014-04-26 Thread Tim Kersten
On Saturday, April 26, 2014 12:29:50 AM UTC+1, Michael Bayer wrote: On Apr 25, 2014, at 6:54 PM, Tim Kersten t...@io41.com javascript: wrote: This is an unusual use case because it seems like you’d like to outright ignore the row if it doesn’t match? or are you throwing an exception

Re: [sqlalchemy] update where using the ORM

2014-04-25 Thread Tim Kersten
is. The row isn’t locked if you aren’t using SELECT..FOR UPDATE. On Apr 23, 2014, at 8:27 PM, Tim Kersten t...@io41.com javascript: wrote: I'd like to run a data migration on a live server, but only update rows if the data hasn't changed since I've read it, and would like to do so optimistically

Re: [sqlalchemy] update where using the ORM

2014-04-25 Thread Tim Kersten
On Friday, April 25, 2014 5:05:21 PM UTC+1, Michael Bayer wrote: On Apr 25, 2014, at 4:22 AM, Tim Kersten t...@io41.com javascript: wrote: Session.query(MyModel).filter_by(foo=old_foo_value).update({'foo': new_foo_value}) This generates something like this: UPDATE mymodel SET foo=%s

Re: [sqlalchemy] update where using the ORM

2014-04-25 Thread Tim Kersten
On Friday, April 25, 2014 11:19:40 PM UTC+1, Michael Bayer wrote: On Apr 25, 2014, at 5:40 PM, Tim Kersten t...@io41.com javascript: wrote: On Friday, April 25, 2014 5:05:21 PM UTC+1, Michael Bayer wrote: On Apr 25, 2014, at 4:22 AM, Tim Kersten t...@io41.com wrote: Session.query

[sqlalchemy] update where using the ORM

2014-04-23 Thread Tim Kersten
conditionally like above? Kindest Regards, Tim -- 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

[sqlalchemy] 'MySQL server has gone away' on closing connection

2014-03-27 Thread Tim Tisdall
away', None) Shouldn't SQLAlchemy closing a connection catch this type of exception and ignore it? If the mysql connection has gone away, can it not be considered closed? -Tim -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

[sqlalchemy] Re: What are the ORM mechanics when appending a new association in an M to N relationship?

2014-03-27 Thread Tim Tisdall
(sqlalchemy.engine).setLevel(logging.INFO) # change it to DEBUG if you want the results of the queries too -Tim On Thursday, 27 March 2014 09:27:42 UTC-4, Darin Gordon wrote: Let me preface this by saying that I researched to the best of my abilities the answers to my following inquiries. I would not ask

Re: [sqlalchemy] 'MySQL server has gone away' on closing connection

2014-03-27 Thread Tim Tisdall
like that. Or are the pool connections recycled just before the next use and not after 4hrs elapse? -Tim On 27 March 2014 11:44, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 27, 2014, at 10:03 AM, Tim Tisdall tisd...@gmail.com wrote: Today I found the following traceback in my logs

[sqlalchemy] session and thread confusion

2014-03-25 Thread Tim Tisdall
I've been reading through the SQLAlchemy docs for a while now and am still fairly confused about using SQLAlchemy with threaded processes. Hopefully my specific question helps me understand things a little more... I'm using the Pyramid framework with SQLAlchemy. The default scaffold for this

[sqlalchemy] Re: session and thread confusion

2014-03-25 Thread Tim Tisdall
After putting more logging on it seems that `with transaction.manager` contexts are committing and returning the connection to the connection pool as I'd hoped. However, I began looking into this more because I got a MySQL server has gone away error despite having sqlalchemy.pool_recycle =

Re: [sqlalchemy] session and thread confusion

2014-03-25 Thread Tim Tisdall
Thanks, that does clear up some of the components for me. On Tuesday, 25 March 2014 16:05:26 UTC-4, Simon King wrote: On 25 Mar 2014, at 19:05, Tim Tisdall tis...@gmail.com javascript: wrote: I've been reading through the SQLAlchemy docs for a while now and am still fairly confused

Re: [sqlalchemy] Find out what's going to be deleted

2013-12-11 Thread Tim Kersten
://stackoverflow.com/q/16875605/675646 ) Cheers, Tim -- 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

Re: [sqlalchemy] Find out what's going to be deleted

2013-12-11 Thread Tim Kersten
On 11 Dec 2013, at 16:32, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 11, 2013, at 8:02 AM, Tim Kersten t...@io41.com wrote: The before_delete and after_delete shouldn't make use of the current Session though, according to http://docs.sqlalchemy.org/en/rel_0_9/orm/events.html

Re: [sqlalchemy] ORM events order

2013-12-06 Thread Tim Kersten
Thank you very much On Thursday, December 5, 2013 5:20:57 PM UTC, Michael Bayer wrote: On Dec 5, 2013, at 12:14 PM, Tim Kersten t...@io41.com javascript: wrote: thank you. What of the relative ordering of the different ORM event types? i.e. before_flush before_delete

[sqlalchemy] ORM events order

2013-12-05 Thread Tim Kersten
Hi Folks, Is the order ORM events ( http://docs.sqlalchemy.org/en/rel_0_9/orm/events.html ) are fired in deterministic and guaranteed to be the same every time? I've searched the docs and google but couldn't anything relating to their relative order. Cheers, Tim -- You received

Re: [sqlalchemy] ORM events order

2013-12-05 Thread Tim Kersten
Dec 2013, at 16:01, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 5, 2013, at 10:51 AM, Tim Kersten t...@io41.com wrote: Hi Folks, Is the order ORM events ( http://docs.sqlalchemy.org/en/rel_0_9/orm/events.html ) are fired in deterministic and guaranteed to be the same every time

Re: [sqlalchemy] SQLSoup, whitespace

2013-11-16 Thread Tim Pierson
Ahh! yes ! I tried that but in my fatigue I got the syntax wrong. Thanks! Sent from my iPad On Nov 16, 2013, at 2:35 PM, Simon King si...@simonking.org.uk wrote: On 16 Nov 2013, at 00:23, Tim Pierson tim.pier...@gmail.com wrote: Happy Friday night everyone. Maybe there's an easy way

[sqlalchemy] SQLSoup, whitespace

2013-11-15 Thread Tim Pierson
Happy Friday night everyone. Maybe there's an easy way to deal with this: How can I use the SQLSoup insert function to update columns whose names contain whitespace? ie: db.table.insert(XML Schema Version=None) Are there any cool tricks I don't know? Thanks -- You received this message

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-10-25 Thread Tim Pierson
Hi everyone, I'm new to SQLSoup and only have a little sqlalchemy experience and I'm wondering if anyone can give me some direction on how to use the subclassed sqlsoup object outlined in previous posts. I also have more than a few talbes with no primary keys that I need dynamically mapped

Re: [sqlalchemy] dynamically mapped tables with ORM

2013-10-25 Thread Tim Pierson
() On Oct 25, 2013, at 3:33 PM, Tim Pierson tim.p...@gmail.com javascript: wrote: Hi everyone, I'm new to SQLSoup and only have a little sqlalchemy experience and I'm wondering if anyone can give me some direction on how to use the subclassed sqlsoup object outlined in previous posts

[sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Tim Tisdall
I'll try to make this succinct... I'm creating a temporary table and then doing a query with it that takes a good length of time. I found that the source tables going into the temporary table were being locked after the temporary table was created even though they were no longer needed for

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
In `Company.__init__()`, instead of blindly creating a new `Creator` instance, you need to first query for an existing Creator with that name. If it exists, append it, otherwise, create a new one and append that. -- Tim Van Steenburgh On Monday, August 12, 2013 at 9:26 PM, csdr...@gmail.com

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
= relationship(Creator, backref=companies, cascade=all) def __init__(self, company, creator): self.company = company existing_creator = DBSession(Creator).query.filter_by(name=creator).first() self.creator.append(existing_creator or Creator(creator)) -- Tim Van Steenburgh

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
Sorry, that should have been: existing_creator = DBSession(Creator).query.filter_by(creator=creator).first() On Monday, August 12, 2013 at 9:49 PM, Tim Van Steenburgh wrote: It's not the append that's causing the error, it's the fact that you're creating a new Creator() instance, which

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
Ad, one more try: existing_creator = DBSession.query(Creator).filter_by(name=creator).first() -- Tim Van Steenburgh On Monday, August 12, 2013 at 9:50 PM, Tim Van Steenburgh wrote: Sorry, that should have been: existing_creator = DBSession(Creator).query.filter_by(creator

[sqlalchemy] Re: Session.add doesn't work on Python 3.3.0?

2013-04-17 Thread Tim Cooijmans
I did some more testing and it appears to be Python 3.3.0 only. Indeed the exact same code with exactly the same SQLAlchemy version works on Python 3.3.1 but not in Python 3.3.0. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

[sqlalchemy] Session.add doesn't work on Python 3.3.0?

2013-04-16 Thread Tim Cooijmans
I have a strange error using Python 3.3.0 and SQLAlchemy 0.8.0: from sqlalchemy import create_engine, Integer, String, Text, Column, Sequence, DateTime, ForeignKeyfrom sqlalchemy.orm import sessionmaker, relationship, backreffrom sqlalchemy.ext.declarative import declarative_base engine =

Re: [sqlalchemy] Oracle, version_id_col, and timestamps with time zones

2012-07-25 Thread Tim
I think I've found what is causing my problems. See http://paste.ofcode.org/38cMYRa7u268EsuUnWQXjfg Also, I want to thank you for you help. It is very much appreciated. Tim On Monday, July 23, 2012 10:15:12 PM UTC-4, Michael Bayer wrote: the sqlalchemy.types.TIMESTAMP type has

Re: [sqlalchemy] Oracle, version_id_col, and timestamps with time zones

2012-07-23 Thread Tim
-4, Tim wrote: The microseconds are getting in the way and getting rid of them does work. Unfortunately, the trigger does not get rid of them and there are several applications which write to these tables and depend on the microseconds. It seems to work in cx_Oracle if I call

Re: [sqlalchemy] Oracle, version_id_col, and timestamps with time zones

2012-07-20 Thread Tim
as we do have tests here which we run against cx_oracle with success. On Jul 19, 2012, at 11:01 PM, Tim wrote: I can not get versioning to work in Oracle (it does work for me in sqlite and Postgresql just changing the connect string). I am using timestamp with time zones

Re: [sqlalchemy] Oracle, version_id_col, and timestamps with time zones

2012-07-20 Thread Tim
cx_Oracle.TIMESTAMP as the input size. Do you have some suggestions on how to add this to a custom type, or a decorated type? On Friday, July 20, 2012 11:31:26 AM UTC-4, Michael Bayer wrote: On Jul 20, 2012, at 11:19 AM, Tim wrote: The first thing I did after I started having problems was remove

[sqlalchemy] Database trigger and version_id_generator

2012-07-19 Thread Tim
I would like to use the version_id_col feature. However, our version_id_col is updated by a database trigger and I do not want SQLAlchemy to try to set this value. Is there a way to do this? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view

[sqlalchemy] Oracle, version_id_col, and timestamps with time zones

2012-07-19 Thread Tim
I can not get versioning to work in Oracle (it does work for me in sqlite and Postgresql just changing the connect string). I am using timestamp with time zones for the version_id_col. Can anyone verify that this does work. SQLAlchemy==0.7.8 cx-Oracle==5.1.2 Python 2.6.6 (r266:84292, Dec 27

[sqlalchemy] How to resolve ForeignKey to object reference

2012-01-25 Thread Tim Black
=... but haven't been able to get it right. Tim -- 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+unsubscr...@googlegroups.com. For more

Re: [sqlalchemy] How to resolve ForeignKey to object reference

2012-01-25 Thread Tim Black
On 01/25/2012 01:57 PM, Tim Black wrote: My *model* is like this: __init__.py: from projects.model.auth import User from projects.model.main import Company auth.py: class User(DeclarativeBase): company_id = Column('company_id', Integer, ForeignKey('company.id')) # many-to-one

Re: [sqlalchemy] order_by on model property

2011-09-08 Thread Tim Black
it in this order_by query? I'm beginning to wonder if it's easier to deal with sorting by @properties by sorting in Python after running the query--is that the case? Tim On 09/07/2011 03:19 PM, Michael Bayer wrote: You'd use a hybrid for this case, and due to the usage of float() you'd

[sqlalchemy] order_by on model property

2011-09-07 Thread Tim Black
or string expected. Tim -- 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+unsubscr...@googlegroups.com. For more options, visit

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
the necessary changes to imports in model sub-modules) for making a relation between two databases are below. Tim --- /tmp/bzr-diff-EWNNdM/old/projects/projects/model/__init__.py +++ /tmp/bzr-diff-EWNNdM/new/projects/projects/model/__init__.py @@ -12,16 +12,16 @@ -maker2 = sessionmaker(autoflush

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
will be used for all classes, mappers, and tables except where another engine is specified by binds. For brevity's sake, I note that 1. is implicit in 2. Tim On Aug 17, 2011, at 12:03 PM, Tim Black wrote: Michael, Thank you for your advice. It took me a while to figure out how to follow

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
On 08/17/2011 02:05 PM, Michael Bayer wrote: On Aug 17, 2011, at 1:06 PM, Tim Black wrote: But here is how the docs could be made more clear - simply state 1. whether it is allowable to use bind and binds simultaneously on the same object, and (if 2. is the case) 2. that the engine specified

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
On 08/17/2011 03:30 PM, Tim Black wrote: On 08/17/2011 02:05 PM, Michael Bayer wrote: On Aug 17, 2011, at 1:06 PM, Tim Black wrote: But here is how the docs could be made more clear - simply state 1. whether it is allowable to use bind and binds simultaneously on the same object, and (if 2

[sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-13 Thread Tim Black
properties that reference the WorkDone model object like this one does: @property def totalHours(self): return sum([w.elapsed for w in self.*workDone*]) Thank you for any help you can offer! Tim -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] versioning and complex collection

2011-02-24 Thread Tim-Erwin
, and value2 would be column names. Does that relate to column_mapped_collection? I'd be thankful for any hints on which mechanisms of SQLA would help or which classes to use. Thanks Tim -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

[sqlalchemy] Re: versioning and complex collection

2011-02-24 Thread Tim-Erwin
Michael, thanks a lot for your thorough and informative reply. I'll take my time and think about all that / try out stuff. Just so you know why it's taking so long till I answer again... Tim -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Excluding tables

2010-12-21 Thread tim
Hi, I have some meta-data columns in my schema. How can I make sure they are not part of the SELECT, INSERT and UPDATE statements SQLAlchemy is doing in the background? I tried: Column('lastUpdate', DateTime, DefaultClause('CURRENT_TIMESTAMP'), nullable=False), # for Nebula's Syncer along

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Tim Aerts
without having them in the SA-generated INSERTs/UPDATEs? Op 21/12/2010 15:59, Michael Bayer schreef: On Dec 21, 2010, at 8:36 AM, tim wrote: Hi, I have some meta-data columns in my schema. How can I make sure they are not part of the SELECT, INSERT and UPDATE statements SQLAlchemy is doing

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Tim Aerts
/2010 16:09, Tim Aerts schreef: Yes, I do want to exclude it all together. But we are creating the database from a createall() call. So if leave it out of the SA schema definition, it will also disappear in the CREATE TABLE statements. Is there any way, whatsoever, to included them in the SA

Re: [sqlalchemy] sqlalchemy and desktop apps

2010-09-13 Thread Tim Black
-planning-of-may_15.html Tim -- 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] Question Using MySQL Function Encode

2009-08-28 Thread Tim
I have a small project I am trying to finish and I ran into a hiccup. I saw the sqlachemy.sql.func object and decided to try to use it. Here is the code to get us on the same page. userPassword = 'thisisasalt'; insertDictionary = [{ 'user_name': user_name, 'user_pwd':

[sqlalchemy] Re: Quick way to deep copy an object?

2008-09-10 Thread Tim Jones
, which we will then modify. The original object and all its relationships should remain unchanged (other than a relationship to its successor version). We would want the copied object and all its relationships saved to the database before making changes to it. Regards, Tim 2008/9/9 Michael Bayer

[sqlalchemy] Re: Quick way to deep copy an object?

2008-09-10 Thread Tim Jones
Michael, I get the idea thanks. Before I embarked on this - I wanted to check that there was not a simple way that I had overlooked. Thanks for your time. Regards, Tim 2008/9/10 Michael Bayer [EMAIL PROTECTED] On Sep 10, 2008, at 4:39 AM, Tim Jones wrote: Michael, Thanks for your

[sqlalchemy] ConcurrentModificationError with transactional sessions

2008-04-14 Thread Tim Lesher
! -- Tim Lesher [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL

[sqlalchemy] Re: ConcurrentModificationError with transactional sessions

2008-04-14 Thread Tim Lesher
usually needs to be cleared out   (or at least expire_all() called) after a rollback() occurs. Thanks--explicitly clearing out the session after any rollback fixed the problem. -- Tim Lesher [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: has() and multiple tables

2008-04-08 Thread Tim Lesher
that as both are relatively cheap EXISTS queries. -- Tim Lesher [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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] has() and multiple tables

2008-04-07 Thread Tim Lesher
I'm having some trouble using the has() operator to avoid a long chain of joins in a select. A stripped-down version of my schema looks like this: a Caller has a (phone) number. A Caller can create Connections (each to a phone number). A Connection can involve one or more Tasks, each of which

[sqlalchemy] Reflection + override error with SA 0.3.10 and MySQL

2008-02-25 Thread Tim Lesher
I'm using SQLAlchemy, reflecting from an existing MySQL database. I want to override two DateTime columns to provide proper created and updated timestamps (since MySQL can't handle auto-updating two TIMESTAMP columns in the same row). According to the SA docs, this should work; however, when I

[sqlalchemy] Re: SQLAlchemy advanced tutorial at PyCon

2008-01-30 Thread Tim Lesher
On Jan 28, 4:23 pm, Jonathan Ellis [EMAIL PROTECTED] wrote: What would you like to see covered in an advanced SQLAlchemy session? Something on association objects would be good. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: pyodbc and tables with triggers

2007-03-18 Thread Tim Golden
Rick Morrison wrote: Tim, I committed a patch from ticket #480 today from that adds some improved module-switching code to the MSSQL interface. See how that works for you. I'll have a look when I get near an MSSQL-connected machine (tomorrow earliest). Thanks v. much. TJG

[sqlalchemy] Re: pyodbc and tables with triggers

2007-03-16 Thread Tim Golden
Rick Morrison wrote: Sorry, Stephen, I replied too early; your second email arrived before the first. A whole day before the first. So until we get a real cleanup, you're looking to try modules in this order: ['pyodbc', 'adodbapi', 'pymssql'] Sounds OK to me -- any objections out

[sqlalchemy] Re: pyodbc and tables with triggers

2007-03-10 Thread Tim Golden
I needed to change the connectionstring to use integrated security anyway), FWIW if someone were to be able to review / commit my patch on ticket 488 (http://www.sqlalchemy.org/trac/ticket/488) the integrated security would be there anyway. Haven't got round to patching the SCOPE_IDENTITY

[sqlalchemy] Re: fetchmany() vs sqlite

2007-03-07 Thread Tim Golden
On Mar 6, 11:37 pm, Michael Bayer [EMAIL PROTECTED] wrote: OK who can try Mysql, MS-SQL, Oracle, Firebird for me ? while it seems like it should work positionally for all of them, it sort of seems it should work keyword-wise as well if the DBAPI authors actually read the spec they were

[sqlalchemy] Re: pyodbc and tables with triggers

2007-03-07 Thread Tim Golden
polaar wrote: I recently tried out sqlalchemy with mssql via pyodbc (after being bitten by the adodbapi bug with the truncated parameters), and noticed the following problem: On inserting records into tables with triggers, pyodbc fails on the 'select @@identity as lastrowid' statement with

[sqlalchemy] MSSQL identity inserts [was: pyodbc and tables with triggers]

2007-03-07 Thread Tim Golden
I've looked through the mailing list and can't see this issue raised there so... There is a known issue with retrieving the id of the last inserted row under MSSQL where IDENTITY cols are used and there are triggers involved. It's pretty easy to demonstrate. If I have this construction: db

[sqlalchemy] Re: MSSQL identity inserts [was: pyodbc and tables with triggers]

2007-03-07 Thread Tim Golden
Rick Morrison wrote: OK, I replied to the other thread already, which is really the same issue. See my response there about backward-compatibility. At any rate, we could make it a connection variable like auto_identity_insert. Patches welcome. I'm happy to provide a patch. Not sure about

[sqlalchemy] MSSQL Trusted Connections?

2007-02-21 Thread Tim Golden
I've gone through the archives, but there doesn't appear to have been any discussion on the use of trusted connections to MSSQL servers. (aka NT authentication, passthrough etc.) If I've overlooked a previous discussion and am rehashing things then please do point it out. Of the three db

[sqlalchemy] Re: MSSQL Trusted Connections?

2007-02-21 Thread Tim Golden
Paul Johnston wrote: I think having a null user name imply a trusted connection would be fine. If you want to progress this, I suggest you create a ticket and supply a patch to do this, at least for adodbapi and pyodbc. Will do. As for What do I use with Python to access MS SQL Server? - I

[sqlalchemy] Job Opening

2007-01-25 Thread Tim Van Steenburgh
Tower Hill Insurance Group http://www.thig.com (Gainesville, FL, USA) = JOB DESCRIPTION - We're looking for a talented, enthusiastic programmer to join our web team. You'll be responsible for supporting/enhancing