- changed milestone to 0.6.xx
Out-of-tree dialects won't import in IPython / rpdb2
Out-of-tree dialects found with pkg_resources can't be used in IPython because sys.exc_info()[2](2).tb_next is not None
. I think that's because, under (my) IPython, SQLAlchemy is under the influence of the rpdb2
import hook.
e.g. {{{ ipython -c "import sqlalchemy; sqlalchemy.create_engine('fictional://dialect')" }}} won't work even if there is a sqlalchemy.dialects
entry point named fictional
.
I made this change to compensate:
Index: lib/sqlalchemy/engine/url.py
===================================================================
--- lib/sqlalchemy/engine/url.py (revision 6511)
+++ lib/sqlalchemy/engine/url.py (working copy)
@@ -101,13 +101,14 @@
module = getattr(module, driver)
return module.dialect
- except ImportError:
- if sys.exc_info()[2](2).tb_next is None:
+ except ImportError, e:
+ try:
import pkg_resources
for res in pkg_resources.iter_entry_points('sqlalchemy.dialects'):
if res.name == self.drivername:
return res.load()
- raise
+ except ImportError, j:
+ raise e
Comments (5)
-
repo owner -
Account Deleted I think the author was trying to detect
import exists exists.py: import does_not_exist
-
repo owner ok sorry it was my crappy code from years back, and what its doing doesn't apply now since the actual DBAPI module is loaded in a separate step.
If someone could try ffdbcbc89a2ac12be499944195572d3014b34061 with their dialect that would be a great help (I didn't try it).
-
Account Deleted It works. Thank you!
-
repo owner - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
i wonder what the purpose of the
tb_next
line is.