database

Overview

Returns or sets the default database for the current connection. (read/write)

See also: MariaDB Connector/Python 1.1 and in 1.0

EXAMPLES

Print the current database and then change to a different database:

import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',
    database = 'mysql',
    )

print(conn.database) # Prints: 'mysql'
conn.database = 'test'

CHANGE HISTORY

Release Series

History

1.1

  • Present starting in MariaDB Connector/Python 1.1.0rc1.

1.0

  • Present starting in MariaDB Connector/Python 1.0.0.