Fixed regression caused by SQLAlchemy 1.4 where the "alembic current"
command would fail due to changes in the ``URL`` object.
Change-Id: Ic0023885188c75ace19035adcf4c11c7bd10a843
Fixes: #816
from sqlalchemy.engine import url
+from . import sqla_compat
from .compat import binary_type
from .compat import collections_abc
from .compat import string_types
def obfuscate_url_pw(u):
u = url.make_url(u)
if u.password:
- u.password = "XXXXX"
+ if sqla_compat.sqla_14:
+ u = u.set(password="XXXXX")
+ else:
+ u.password = "XXXXX"
return str(u)
--- /dev/null
+.. change::
+ :tags: bug, environment
+ :tickets: 816
+
+ Fixed regression caused by SQLAlchemy 1.4 where the "alembic current"
+ command would fail due to changes in the ``URL`` object.
+
with self._assert_lines(["a3"]):
command.current(self.cfg)
+ def test_current_obfuscate_password(self):
+ eq_(
+ util.obfuscate_url_pw("postgresql://scott:tiger@localhost/test"),
+ "postgresql://scott:XXXXX@localhost/test",
+ )
+
def test_two_heads(self):
command.stamp(self.cfg, ())
command.stamp(self.cfg, (self.a1.revision, self.b1.revision))