Schema (MySQL Instance)

class schemaobject.schema.SchemaObject(connection_url)

Object representation of a single MySQL instance. If database name is not specified in connection_url, all databases on the MySQL instance will be loaded.

connection_url - the database url as per RFC1738

>>> schema  = schemaobject.SchemaObject('mysql://username:password@localhost:3306/sakila')
>>> schema.host
'localhost'
>>> schema.port
3306
>>> schema.user
'username'
>>> schema.version
'5.1.30'
>>> schema.selected.name
'sakila'
databases

Lazily loaded dictionary of the databases within this MySQL instance.

See DatabaseSchema for usage:

#if database name is specified in the connection url
>>> len(schema.databases)
1
>>> schema.databases.keys()
['sakila']
selected

Returns the DatabaseSchema object associated with the database name in the connection url

>>> schema.selected.name
'sakila'

Previous topic

SchemaObject v0.5.1 documentation

Next topic

Database

This Page