Hopefully this should be pretty straightforward. I'm running the following
example which fails under Jython 2.7.0 with postgresql-9.4-1203.jdbc42.jar
using sqlalchemy 1.0.8 with PostgreSQL 9.3.9 on Ubuntu 14.04. Any help
would be much appreciated.
Example and stack trace below:
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy.orm import sessionmaker, scoped_session, relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
from sqlalchemy.types import Integer, String, Float
Session = scoped_session(sessionmaker())
Base = declarative_base()
class Address(Base):
__tablename__ = 'address'
id = Column(Integer, primary_key=True)
email_address = Column(String, nullable=False)
person_id = Column(Integer, ForeignKey('person.id'))
class Person(Base):
__tablename__ = 'person'
id = Column(Integer, primary_key=True)
_rate = Column(Float)
name = Column(String, nullable=False)
addresses = relationship("Address", order_by="Address.id", backref="person")
engine =
create_engine('postgresql+zxjdbc://michael:test123@localhost:5432/ajtest',
echo=True)
#engine = create_engine('postgresql://michael:test123@localhost:5432/ajtest',
echo=True)
Session.configure(bind=engine)
Base.metadata.bind = engine
Base.metadata.drop_all(checkfirst=True)
Base.metadata.create_all()
s = Session()
mickeybob = Person(name='Michael')
s.add(mickeybob)
s.add(Address(email_address='[email protected]',
person=mickeybob))
s.commit()
for a in s.query(Address).all():
print a.email_address, a.person.name
------
Here is the error I get when running under Jython:
$ jython test_sqla.py
2015-10-06 15:32:58,750 INFO sqlalchemy.engine.base.Engine select
current_schema()
2015-10-06 15:32:58,753 INFO sqlalchemy.engine.base.Engine ()
2015-10-06 15:32:58,808 INFO sqlalchemy.engine.base.Engine SELECT
CAST('test plain returns' AS VARCHAR(60)) AS anon_1
2015-10-06 15:32:58,813 INFO sqlalchemy.engine.base.Engine ()
2015-10-06 15:32:58,816 INFO sqlalchemy.engine.base.Engine SELECT
CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
2015-10-06 15:32:58,819 INFO sqlalchemy.engine.base.Engine ()
2015-10-06 15:32:58,821 INFO sqlalchemy.engine.base.Engine show
standard_conforming_strings
2015-10-06 15:32:58,822 INFO sqlalchemy.engine.base.Engine ()
2015-10-06 15:32:58,835 INFO sqlalchemy.engine.base.Engine select relname
from pg_class c join pg_namespace n on n.oid=c.relnamespace where
pg_catalog.pg_table_is_visible(c.oid) and relname=?
2015-10-06 15:32:58,845 INFO sqlalchemy.engine.base.Engine (u'address',)
2015-10-06 15:32:58,865 INFO sqlalchemy.engine.base.Engine select relname
from pg_class c join pg_namespace n on n.oid=c.relnamespace where
pg_catalog.pg_table_is_visible(c.oid) and relname=?
2015-10-06 15:32:58,874 INFO sqlalchemy.engine.base.Engine (u'person',)
Traceback (most recent call last):
File "test_sqla.py", line 29, in <module>
Base.metadata.drop_all(checkfirst=True)
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/schema.py",
line 3711, in drop_all
bind._run_visitor(ddl.SchemaDropper,
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/engine/base.py",
line 1856, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/engine/base.py",
line 1480, in _run_visitor
visitorcallable(self.dialect, self,
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/visitors.py",
line 121, in traverse_single
return meth(obj, **kw)
File "/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/ddl.py",
line 813, in visit_metadata
filter_fn=lambda constraint: False
File "/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/ddl.py",
line 813, in visit_metadata
filter_fn=lambda constraint: False
File "/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/ddl.py",
line 1067, in sort_tables_and_constraints
candidate_sort = list(
File "/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/sql/ddl.py",
line 1067, in sort_tables_and_constraints
candidate_sort = list(
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/util/topological.py",
line 50, in sort
for set_ in sort_as_subsets(tuples, allitems, deterministic_order):
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/util/topological.py",
line 39, in sort_as_subsets
todo.difference_update(output)
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/util/_collections.py",
line 458, in difference_update
set.difference_update(self, other)
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/util/_collections.py",
line 458, in difference_update
set.difference_update(self, other)
[removed repeated recursive calls]
File
"/home/michael/jython2.7.0/Lib/site-packages/sqlalchemy/util/_collections.py",
line 458, in difference_update
set.difference_update(self, other)
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.