Re: [sqlalchemy] uwsgi + sqlalchemy - forking concern

2014-06-16 Thread Jonathan Vanasco
Thanks Michael  Jeff.

I'm reading this as the issue is in the underlying dbconnection that 
sqlalchemy has , not creating a sqlalchemy engine.

If that is the case, then I don't have anything to worry about now -- but 
will add in an `engine.dispose()` hook after the fork just to be safe.

-- 
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@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Intermittent error when retrieving an attribute of a persistent object

2014-06-16 Thread Mike Bayer
it's unlikely we can do much about that, jython is hardly used at all 
and is not a well-maintained platform; it regularly has subtle 
interpreter bugs and such.  pg8000 is in better shape these days but 
tracking down something like this would require careful pdb debugging 
and tracing.  That it's an intermittent bug makes it that much more 
difficult to track.

On Mon Jun 16 11:22:11 2014, tony.locke wrote:
 Hi, I'm using SQLAlchemy 0.8.6 on Jython 2.5.3 with the
 postgresql+pg8000 dialect, and I find I'm getting the following
 intermittent error when retrieving an attribute of a persistent
 object. The attribute is itself a persistent object. Any help would be
 most appreciated. Thanks, Tony.

 null org.python.core.PyException nullTraceback (most recent call last):

   *
   *   File string, line 55, in module
   *
   *   File string, line 55, in module
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\attributes.py,
 line 316, in __get__
   *
   * return self.impl.get(instance_state(instance), dict_)
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\attributes.py,
 line 613, in get
   *
   * value = self.callable_(state, passive)
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\strategies.py,
 line 524, in _load_for_state
   *
   * return self._emit_lazyload(session, state, ident_key, passive)
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\strategies.py,
 line 563, in _emit_lazyload
   *
   * return loading.load_on_ident(q, ident_key)
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py,
 line 226, in load_on_ident
   *
   * return q.one()
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py,
 line 226, in load_on_ident
   *
   * return q.one()
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\query.py,
 line 2323, in one
   *
   * ret = list(self)
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py,
 line 72, in instances
   *
   * rows = [process[0](row, None) for row in fetch]
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py,
 line 356, in _instance
   *
   * tuple([row[column] for column in pk_cols])
   *
   *   File D:\Program Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\engine\result.py,
 line 91, in __getitem__
   *
   * return self._row[index]
   *
   * IndexError: index out of range: 0
   *
   *
   *
   *   at org.python.core.Py.IndexError(Py.java:250)
   *
   *   at
 
 org.python.core.SequenceIndexDelegate.checkIdxAndGetItem(SequenceIndexDelegate.java:63)
   *
   *   at org.python.core.PySequence.seq___getitem__(PySequence.java:305)
   *
   *   at org.python.core.PySequence.__getitem__(PySequence.java:301)
   *
   *   at sqlalchemy.engine.result$py.__getitem__$9(D:\Program
 Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\engine\result.py:91)
   *
   *   at sqlalchemy.engine.result$py.call_function(D:\Program
 Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\engine\result.py)
   *
   *   at org.python.core.PyTableCode.call(PyTableCode.java:165)
   *
   *   at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
   *
   *   at org.python.core.PyFunction.__call__(PyFunction.java:327)
   *
   *   at org.python.core.PyMethod.__call__(PyMethod.java:124)
   *
   *   at org.python.core.PyMethod.__call__(PyMethod.java:115)
   *
   *   at
 org.python.core.PyObjectDerived.__getitem__(PyObjectDerived.java:900)
   *
   *   at sqlalchemy.orm.loading$py._instance$9(D:\Program Files\Apache
 Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py:497)
   *
   *   at sqlalchemy.orm.loading$py.call_function(D:\Program
 Files\Apache Software Foundation\Tomcat
 7.0\webapps\chellow\WEB-INF\lib-python\sqlalchemy\orm\loading.py)
   *
   *   at org.python.core.PyTableCode.call(PyTableCode.java:165)
   *
   *   at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
   *
   *   at org.python.core.PyFunction.__call__(PyFunction.java:327)
   *
   *   at sqlalchemy.orm.loading$py.instances$1(D:\Program Files\Apache
 Software Foundation\Tomcat
 

Re: [sqlalchemy] column ordering with union_all and joinedload?

2014-06-16 Thread Mike Bayer
SQLAlchemy targets mapped entities in a result set by their position 
within the Query object's entities.  It's not possible to have a UNION 
that returns some objects of type A and then some objects of type B in 
the same position, unless those two classes are related through 
polymorphic inheritance with a discriminator.



On Mon Jun 16 10:36:04 2014, Craig Sabbey wrote:
 I'm trying to union the same query for 2 tables with the same
 structure, along with joinedloads for these tables. When I use
 DBSession([TABLE]) for each query in the union, the columns come back
 in different orders. If I specify the columns
 (DBSession([TABLE.COL_A], [TABLE.COL_B], ...) then the joinedloads
 fail with Query has only expression-based entities.

 Here is some pseudo-code to hopefully make it clear what I'm trying to do:

   q0 = DBSession.query(T0).options(joinedload('ref')
   q1 = DBSession.query(T1).options(joinedload('ref')
   return q0.union_all(q1).all()

 Is there another way to perform this query?

 --
 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
 mailto:sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com
 mailto:sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/d/optout.

-- 
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@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.