SQLAlchemy 0.4 Documentation
module sqlalchemy.engine.url
Provides the URL class which encapsulates information about a database connection specification.
The URL object is created automatically when create_engine() is called with a string argument; alternatively, the URL is a public-facing construct which can be used directly and is also accepted directly by create_engine().
Module Functions
class URL(object)
Represent the components of a URL used to connect to a database.
This object is suitable to be passed directly to a create_engine() call. The fields of the URL are parsed from a string by the module-level make_url() function. the string format of the URL is an RFC-1738-style string.
Attributes on URL include:
- drivername
- the name of the database backend. This name will correspond to a module in sqlalchemy/databases or a third party plug-in.
- username
- The user name for the connection.
- password
- database password.
- host
- The name of the host.
- port
- The port number.
- database
- The database.
- query
- A dictionary containing key/value pairs representing the URL's query string.
Construct a new URL.
Return the SQLAlchemy database dialect class corresponding to this URL's driver name.
Translate url attributes into a dictionary of connection arguments.
Returns attributes of this url (host, database, username, password, port) as a plain dictionary. The attribute names are used as the keys by default. Unset or false attributes are omitted from the final dictionary.
- **kw
Optional, alternate key names for url attributes:
# return 'username' as 'user' username='user' # omit 'database' database=None
- names
- Deprecated. A list of key names. Equivalent to the keyword usage, must be provided in the order above.
