# Database API

For details on how to use database, see Using OpenStack Database

## The Database Class

The database high-level interface is available through the `database` member of a `Connection` object. The `database` member will only be added if the service is detected.

### Database Operations

class openstack.database.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_database(instance, **attrs)

    Create a new database from attributes

    Parameters:

      - instance – This can be either the ID of an instance or a `Instance`

      - attrs (dict) – Keyword arguments which will be used to create a `Database`, comprised of the properties on the Database class.

    Returns:

      The results of server creation

    Return type:

      `Database`

  delete_database(database, instance=None, ignore_missing=True)

    Delete a database

    Parameters:

      - database – The value can be either the ID of a database or a `Database` instance.

      - instance – This parameter needs to be specified when an ID is given as database. It can be either the ID of an instance or a `Instance`

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the database does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent database.

    Returns:

      `None`

  find_database(name_or_id, instance, ignore_missing=True)

    Find a single database

    Parameters:

      - name_or_id – The name or ID of a database.

      - instance – This can be either the ID of an instance or a `Instance`

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `Database` or None

  databases(instance, **query)

    Return a generator of databases

    Parameters:

      - instance – This can be either the ID of an instance or a `Instance` instance that the interface belongs to.

      - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of database objects

    Return type:

      `Database`

  get_database(database, instance=None)

    Get a single database

    Parameters:

      - instance – This parameter needs to be specified when an ID is given as database. It can be either the ID of an instance or a `Instance`

      - database – The value can be the ID of a database or a `Database` instance.

    Returns:

      One `Database`

    Raises:

      `NotFoundException` when no resource can be found.

### Flavor Operations

class openstack.database.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  find_flavor(name_or_id, ignore_missing=True)

    Find a single flavor

    Parameters:

      - name_or_id – The name or ID of a flavor.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `Flavor` or None

  get_flavor(flavor)

    Get a single flavor

    Parameters:

      flavor – The value can be the ID of a flavor or a `Flavor` instance.

    Returns:

      One `Flavor`

    Raises:

      `NotFoundException` when no resource can be found.

  flavors(**query)

    Return a generator of flavors

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of flavor objects

    Return type:

      `Flavor`

### Instance Operations

class openstack.database.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_instance(**attrs)

    Create a new instance from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Instance`, comprised of the properties on the Instance class.

    Returns:

      The results of server creation

    Return type:

      `Instance`

  delete_instance(instance, ignore_missing=True)

    Delete an instance

    Parameters:

      - instance – The value can be either the ID of an instance or a `Instance` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the instance does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent instance.

    Returns:

      `None`

  find_instance(name_or_id, ignore_missing=True)

    Find a single instance

    Parameters:

      - name_or_id – The name or ID of a instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `Instance` or None

  get_instance(instance)

    Get a single instance

    Parameters:

      instance – The value can be the ID of an instance or a `Instance` instance.

    Returns:

      One `Instance`

    Raises:

      `NotFoundException` when no resource can be found.

  instances(**query)

    Return a generator of instances

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of instance objects

    Return type:

      `Instance`

  update_instance(instance, **attrs)

    Update a instance

    Parameters:

      - instance – Either the id of a instance or a `Instance` instance.

      - attrs – The attributes to update on the instance represented by `instance`.

    Returns:

      The updated instance

    Return type:

      `Instance`

### User Operations

class openstack.database.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_user(instance, **attrs)

    Create a new user from attributes

    Parameters:

      - instance – This can be either the ID of an instance or a `Instance`

      - attrs (dict) – Keyword arguments which will be used to create a `User`, comprised of the properties on the User class.

    Returns:

      The results of server creation

    Return type:

      `User`

  delete_user(user, instance=None, ignore_missing=True)

    Delete a user

    Parameters:

      - user – The value can be either the ID of a user or a `User` instance.

      - instance – This parameter needs to be specified when an ID is given as user. It can be either the ID of an instance or a `Instance`

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the user does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent user.

    Returns:

      `None`

  find_user(name_or_id, instance, ignore_missing=True)

    Find a single user

    Parameters:

      - name_or_id – The name or ID of a user.

      - instance – This can be either the ID of an instance or a `Instance`

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `User` or None

  users(instance, **query)

    Return a generator of users

    Parameters:

      - instance – This can be either the ID of an instance or a `Instance`

      - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of user objects

    Return type:

      `User`

  get_user(user, instance=None)

    Get a single user

    Parameters:

      - user – The value can be the ID of a user or a `User` instance.

      - instance – This parameter needs to be specified when an ID is given as database. It can be either the ID of an instance or a `Instance`

    Returns:

      One `User`

    Raises:

      `NotFoundException` when no resource can be found.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.