Create Database
A user wants to create a database in DBRepo.
UI¶
A database can be created by choosing a name (e.g. My Database), selecting an engine (e.g. MariaDB) and defining the visibility, this can be changed later.
Python¶
Python Compatibility
Ensure that you use the same Python library version as the target instance. For example: if you see 1.9.2
in the
bottom left, you need to use the 1.9.2
Python library.
List all available containers with their database engine descriptions and obtain a container id.
from dbrepo.RestClient import RestClient
client = RestClient(endpoint="http://<hostname>", username="foo",
password="bar")
containers = client.get_containers()
print(containers)
Create a public database with the container id from the previous step.
from dbrepo.RestClient import RestClient
client = RestClient("http://<hostname>", username="foo", password="bar")
database = client.create_database("My Database",
"6cfb3b8e-1792-4e46-871a-f3d103527203",
is_public=False,
is_schema_public=False)
print(f"database id: {database.id}")