Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-27 Thread Will Angenent
randomness of the problem made it especially difficult to diagnose. This is probably such an edge case that it’s not worth spending any more time on. I’m happy I understand what’s going on now at least. Thanks, Will -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-23 Thread Will Angenent
s/sqlalchemy/orm/relationships.py", line 2076, in _determine_joins "specify a 'primaryjoin' expression." % self.prop) sqlalchemy.exc.NoForeignKeysError: Could not determine join condition between parent/child tables on relationship Table2.table1_stuff - there are no foreign

Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-22 Thread Will Angenent
in the migration; so that doesn’t explain references sticking in some cases. By the way, this isn’t an urgent thing. I made the problem go away by deleting the bad migration; we didn’t need it any more. My interest is purely academic. I’m just worried this might happen again. Mostly though, I d

Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-21 Thread Will Angenent
I forgot to mention, we’re not using clear_mappers(). Thanks, Will > On 21 Feb 2016, at 19:19, Will Angenent wrote: > > Hi Mike, > > Thanks for your quick response yet again! Here’s the stack trace. > > tests/integration/test_database.py:14: in test_d

Re: [sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-21 Thread Will Angenent
# sys.stderr.write('*** name=%s\n' % __name__) # return tag_to_resource What I found is that in the bad case, both tag_to_resource and __name__ were None. Thanks, Will >

[sqlalchemy] alembic del sys.modules[module_id] leading to orm mapper error

2016-02-21 Thread Will Angenent
ration for a many-to-many relationship in a model defined in the migration file. Are we being stupid to be using the ORM in alembic migrations? If not, is it worth for me to spend more time on this? Is there any way to get this to behave non-randomly? More details are below. Thanks, Will Lo

[sqlalchemy] Re: Unexpected missing join when using joined table inheritance

2015-10-06 Thread Will Angenent
Thanks, that's helpful. We should be able to use both solutions. Thanks for the clarification! -- 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+unsubsc

[sqlalchemy] Unexpected missing join when using joined table inheritance

2015-10-05 Thread Will Angenent
I have run into an interesting condition when using joined table inheritance. For example we have the typical employee, manager and engineer tables with the following relationships: - an engineer is an employee - a manager is an employee - an employee has a manager We find some interesting resu

Re: [sqlalchemy] Query hangs after a while

2015-06-13 Thread Will Brown
The problem seems to be independent of context. Happens both when I run python interactively from the prompt, and from within a Pyramid-based web app. I have not tried other connectors or raw DBAPI. Will try that. On Sat, Jun 13, 2015 at 5:48 AM, Mike Bayer wrote: > > > On 6/13/15 3:

Re: [sqlalchemy] Calling stored procedures in SQLAlchemy

2012-06-04 Thread Will Orr
> Session.execute() is not the same as engine.execute(), where the latter is > autocommitting (assuming you also called execution_options(autocommit=True) > for this particular text() construct). > > > > On May 31, 2012, at 9:23 PM, Will Orr wrote: > > Hello all! > >

[sqlalchemy] Calling stored procedures in SQLAlchemy

2012-05-31 Thread Will Orr
Hello all! I'm having this *exact* bug from a few years ago wrt. calling stored procedures. https://groups.google.com/forum/?fromgroups#!topic/sqlalchemy/qA_ypVgJ1B0 What makes it worse, however, is that adding the autocommit execution option or explicitly starting and stopping a transaction do

Re: [sqlalchemy] Add Support for "24:00:00" with Time type

2012-04-18 Thread Will Weaver
For those that end up being interested in something like this. For the complete round robin I did this. from path.to.time import Time from psycopg2 import extensions def cast_time(value, cur): """Cast postgresql Time type to a Time object""" if value is None: return None re

Re: [sqlalchemy] Add Support for "24:00:00" with Time type

2012-04-18 Thread Will Weaver
On Wed, Apr 18, 2012 at 10:57 AM, Michael Bayer wrote: > > On Apr 18, 2012, at 10:47 AM, Will wrote: > > > Yes, I knew about the adapters. A coworker of mine came up with this: > >... > > s = Session() > c = s.connection() > > cast_time = lambda

Re: [sqlalchemy] Add Support for "24:00:00" with Time type

2012-04-18 Thread Will
On Wednesday, April 18, 2012 10:17:43 AM UTC-4, Michael Bayer wrote: > > > On Apr 18, 2012, at 9:36 AM, Will wrote: > > The postgresql Time type supports times from "00:00:00" to "24:00:00" in > accordance with ISO 8601 <http://en.wikipedia.org/wiki/ISO_

[sqlalchemy] Add Support for "24:00:00" with Time type

2012-04-18 Thread Will
support that. I'm using SQLAlchemy 0.6.8 and was wondering if there is a way to allow it to support the "24:00:00" midnight notation. I've tried to make a custom type that would support it, but it seems that psycopg2 will return a datetime.time class even if I define the

Re: [sqlalchemy] default value from column

2011-07-13 Thread Will Weaver
I'm not positive about this but if you are talking about the integer column, all defaults have to be a string or some SQLAlchemy function so you'd want: type = sa.Column(sa.types.Integer, nullable=0, default='1') On Wed, Jul 13, 2011 at 7:37 AM, ddarko wrote: > class AccountHistory(Base): >i

[sqlalchemy] database connection leak found, believed fixed, unclear how - 0.5.5

2011-02-24 Thread Will Berry
I am using SQLAlchemy 0.5.5 which is the version packaged with Red Hat Enterprise 6. I am using the below class to implement transactions using closures. (I have excluded methods unrelated to this issue.) I am using psycopg2 2.0.13 ('postgres://' URLs) to talk to the database, if that matters.

[sqlalchemy] Re: Parent model being queried when deleting Child model

2011-02-11 Thread Will
he load isn't needed and this is actually a recent > regression as of 0.6.6, so 0.6.5 won't exhibit this behavior...of course > 0.6.5 has the previous issue that was fixed here but its likely not as > common.  This is ticket #2049 and a fix will be available shortly. > > Als

[sqlalchemy] Parent model being queried when deleting Child model

2011-02-11 Thread Will
a program to only what it will need to do its work. I have a table that has two parents, that is a foreign key to two tables. One of those tables isn't needed by the application, but it needed for other applications that use these same SQLAlchemy models. The following example shows first a def

Re: [sqlalchemy] passive_deletes="all" still tries to query relationship on delete

2011-01-04 Thread Will Weaver
ff to attributes.py. > > > On Jan 4, 2011, at 10:49 AM, Will Weaver wrote: > >> I made a different patch.  This one I don't believe is ideal, but I >> think it might be the appropriate place to make the patch >> >> http://pastebin.com/kZbZcJ3u >> >> O

Re: [sqlalchemy] passive_deletes="all" still tries to query relationship on delete

2011-01-04 Thread Will Weaver
I made a different patch. This one I don't believe is ideal, but I think it might be the appropriate place to make the patch http://pastebin.com/kZbZcJ3u On Tue, Jan 4, 2011 at 8:58 AM, Will wrote: > Hello, > > I noticed that when setting passive_deletes="all" on a r

[sqlalchemy] passive_deletes="all" still tries to query relationship on delete

2011-01-04 Thread Will
ut that doesn't seem to be the appropriate place for the fix. Thanks for any input. -Will -- 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 t

Re: [sqlalchemy] Getting a list of parameters from a select object Options (cont'd)

2010-12-27 Thread Will Weaver
Does the lack of a response mean that it can't be done or just that no one knows how to do it? Or did I not ask the question good enough? On Tue, Dec 21, 2010 at 12:02 PM, Will wrote: > In continuation of the following post > > http://groups.google.com/group/sqlalchemy/browse

[sqlalchemy] Getting a list of parameters from a select object Options (cont'd)

2010-12-21 Thread Will
In continuation of the following post http://groups.google.com/group/sqlalchemy/browse_thread/thread/160870682c011611/8229a3eb9c10f870?lnk=gst&q=parameters+select#8229a3eb9c10f870 Is there a way to get the columns that the bind parameters correspond to? I was able to get the param values but tha

Re: [sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Will Weaver
I was working on, but it definitely is worth it to get this working. Thanks a lot. -Will On Wed, Dec 15, 2010 at 2:45 PM, Michael Bayer wrote: > This is an interesting edge case and I can probably ensure that the > dependency between Parent/Child is present in the unit of work even if the

[sqlalchemy] Re: Deletion order during flush is not correct.

2010-12-15 Thread Will
ne.0x...6050 (2,) 2010-12-15 14:33:56,697 INFO sqlalchemy.engine.base.Engine.0x...6050 DELETE FROM children WHERE children.id = ? 2010-12-15 14:33:56,697 INFO sqlalchemy.engine.base.Engine.0x...6050 ((1,), (2,)) 2010-12-15 14:33:56,697 INFO sqlalchemy.engine.base.Engine.0x...6050 COMMIT On Dec 15, 2:17 

[sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Will
ion.bind.echo = True begin() session.add_all(children) session.add(parent) commit() begin() for child in children: session.delete(child) session.delete(parent) commit() session.bind.echo = False finally: Model.metadata.drop_all(engine) """ >Fro

Re: [sqlalchemy] composite property not working on a mapped select

2010-12-08 Thread Will Weaver
..@custom_values.setter >    def custom_values(self, value): >        self.v1 = value.v1 >        self.v2 = value.v2 > > I considered replacing the mechanism of composite with the above type of > thing in 0.7 but there were still some edge cases that composites seem to > have. &

[sqlalchemy] composite property not working on a mapped select

2010-12-07 Thread Will
""" Hello, I've been trying to map two tables that have 25 columns each in addition to keys. The parent table's (descriptions) column values represent the key in a dictionary and the child table's (values) column values represent the values of the dictionary. i.e.: table 'descriptions':

[sqlalchemy] Non UTF8 strings retreived via mapped class - 0.5beta3

2008-08-20 Thread Will Temperley
lems but if I go via my mapped class (Source, also see below), I get such errors. Any ideas? Am I just being dumb here? Cheers Will #ENGINE engine = sqlalchemy.create_engine ('postgres://me:[EMAIL PROTECTED]: 5432/MAP', convert_unicode=True) #DOESN'T WORK: Session = sql