diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2022-11-27 16:32:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-11-27 16:32:53 +0000 |
| commit | 372ea0893bb58cd8a5136e9fde4e9130f590bbfd (patch) | |
| tree | 295d7f9712ecf6b0e9742ac9ebee43edb369830d /lib/sqlalchemy | |
| parent | 61443aa62bbef158274ae393db399fec7f054c2d (diff) | |
| parent | 14c73685ba909838fb90d762d465e7ae8d067c15 (diff) | |
| download | sqlalchemy-372ea0893bb58cd8a5136e9fde4e9130f590bbfd.tar.gz | |
Merge "Add recommendation for URL.create() re: escaping" into main
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/url.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index cca31edd0..820e700f3 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -46,15 +46,21 @@ class URL(NamedTuple): """ Represent the components of a URL used to connect to a database. - This object is suitable to be passed directly to a - :func:`_sa.create_engine` call. The fields of the URL are parsed from a - string by the :func:`.make_url` function. The string format of the URL - generally follows `RFC-1738 <https://www.ietf.org/rfc/rfc1738.txt>`_, with - some exceptions. - - To create a new :class:`_engine.URL` object, use the - :func:`.make_url` function. To construct a :class:`_engine.URL` - programmatically, use the :meth:`_engine.URL.create` constructor. + URLs are typically constructed from a fully formatted URL string, where the + :func:`.make_url` function is used internally by the + :func:`_sa.create_engine` function in order to parse the URL string into + its individual components, which are then used to construct a new + :class:`.URL` object. When parsing from a formatted URL string, the parsing + format generally follows + `RFC-1738 <https://www.ietf.org/rfc/rfc1738.txt>`_, with some exceptions. + + A :class:`_engine.URL` object may also be produced directly, either by + using the :func:`.make_url` function with a fully formed URL string, or + by using the :meth:`_engine.URL.create` constructor in order + to construct a :class:`_engine.URL` programmatically given individual + fields. The resulting :class:`.URL` object may be passed directly to + :func:`_sa.create_engine` in place of a string argument, which will bypass + the usage of :func:`.make_url` within the engine's creation process. .. versionchanged:: 1.4 |
