Harrison/engine args (#2177)

Co-authored-by: Alvaro Sevilla <alvarosevilla95@gmail.com>
This commit is contained in:
Harrison Chase 2023-03-29 22:29:38 -07:00 committed by GitHub
parent 7d90691adb
commit bcfd071784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,9 +69,12 @@ class SQLDatabase:
self._metadata.reflect(bind=self._engine)
@classmethod
def from_uri(cls, database_uri: str, **kwargs: Any) -> SQLDatabase:
def from_uri(
cls, database_uri: str, engine_args: Optional[dict] = None, **kwargs: Any
) -> SQLDatabase:
"""Construct a SQLAlchemy engine from URI."""
return cls(create_engine(database_uri), **kwargs)
_engine_args = engine_args or {}
return cls(create_engine(database_uri, **_engine_args), **kwargs)
@property
def dialect(self) -> str: