Skip to main content

CREATE A DATABASE

Because Glitter data is kept in tables in a database, if you wish to use it for data storage and retrieval, you must first establish your own database and data tables. To construct a database, use the CREATE DATABASE statement.

Using the SDK

We currently offer SDKs in Python and JavaScript, and both versions of the SDKs have ways of constructing databases. Here's an example of how to make a database.

The Python SDK's create_database() method can be used to create a database.

XIAN_HOST = "https://api.xian.glitter.link"
#LOCAL_HOST = "http://127.0.0.1:41317"
CHAIN_ID = "glitter_12000-1"
mk = MnemonicKey("your mnemonic words")
client = LCDClient(
chain_id=CHAIN_ID,
url=XIAN_HOST,
gas_prices=Coins.from_str("0.15agli"),
gas_adjustment=Numeric.parse(1.5))
db = client.db(mk)
db.create_database("your_database_name")