SQLAlchemy 0.4 Documentation - module sqlalchemy.engine.url

# SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4 Last Updated: 08/22/07 15:48:11

### module sqlalchemy.engine.url

Provides URL facilities for specifying database connections.

### Module Functions

def make_url(name_or_url)

Given a string or unicode instance, produce a new URL instance.

The given string is parsed according to the RFC 1738 spec. If an existing URL object is passed, just returns the object.

### 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.

def __init__(self, drivername, username=None, password=None, host=None, port=None, database=None, query=None)

Construct a new `URL`.

def get_dialect(self)

Return the SQLAlchemy database dialect class corresponding to this URL's driver name.

def translate_connect_args(self, names)

Translate attributes into a dictionary of connection arguments.

Given a list of argument names corresponding to the URL attributes (host, database, username, password, port), will assemble the attribute values of this URL into the dictionary using the given names.

def __eq__(self, other)
back to section top