On 7/17/15 1:21 PM, Jeffrey McLarty wrote:
Hello,

I've got a very peculiar situation, where SQLA fails to create an engine, because it can't find the installed module, only when I do some relatively straightforward package discovery & import logic using imp.find_module and imp.load_module.

feel free to share that logic.  Otherwise, no clue.

I'm wondering if SQLAlchemy does some magic

only if you consider this to be magic:

module = __import__('sqlalchemy.dialects.%s' % (dialect, )).dialects




which might be impacted if I've used find_module and load_module upstream, despite being in different name spaces(?)

I'm working with Python 2.7.6, SQLAlchemy 0.9.2, and Postgres 9.4, and psycopg2

Here's the traceback...

|
Traceback(most recent call last):
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\pdb.py",line 1314,
inmain
    pdb._runscript(mainpyfile)
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\pdb.py",line 1233,
in_runscript
self.run(statement)
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\bdb.py",line 400,
inrun
execcmd inglobals,locals
File"<string>",line 1,in<module>
File"install.py",line 2,in<module>
fromequitable.db.psyw importDBpicker,SQLAeng,SmartDB
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\site-packages\trump
\orm.py",line 2287,inSetupTrump
    engine =create_engine(engine_str)
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\site-packages\sqlal
chemy\engine\__init__.py",line 344,increate_engine
returnstrategy.create(*args,**kwargs)
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\site-packages\sqlal
chemy\engine\strategies.py",line 50,increate
    dialect_cls =u.get_dialect()
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\site-packages\sqlal
chemy\engine\url.py",line 116,inget_dialect
    cls =registry.load(name)
File"C:\WinPython-32bit-2.7.6.3-20140407\python-2.7.6\lib\site-packages\sqlal
chemy\util\langhelpers.py",line 186,inload
(self.group,name))
NoSuchModuleError:Can't load plugin: sqlalchemy.dialects:postgresql.psycopg2
|


SQLAlchemy works as expected, (ie, it finds psycopg2) if I comment out line 60 of https://github.com/Equitable/trump/blob/master/trump/orm.py (and replace the variable "sources" with an empty dictionary). Line 60, is an import to sub-module which dynamically loads modules.
--
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.

Reply via email to