Turso.Platform.Databases
Interact with databases in Turso.
A database in Turso. Many functions in this module return a Database.
List Databases
Arguments for the list function.
Both group and parent are optional. Not providing them will list all databases
for the given organization specified in Turso.Platform.Connection If provided,
they do the following:
groupwill filter the resulting list based on the group name provided.parentwill filter the resulting list to databases whose parent database matches the id of the passed parent database.
Errors that can happen when attempting to list databases.
ListErrorGroupNotFoundhappens when, if a group name is provided, that group does not exist.ListHttpErrorcaptures any other HTTP errors.
List databases in your Turso organization.
When successfully, returns an Array Database of the retrieved databases.
Get a Single Database
Arguments for the retrieve function.
databaseNameis the name of the database you want to retrieve.
Errors that can happen when attempting to retrieve a database.
RetrieveErrorDatabaseNotFoundhappens when the passed database name does not exist in Turso.RetrieveHttpErrorcaptures any other HTTP errors.
Retrieve a specific database by name.
When successful, returns a single Database record.
Create Databases
Arguments needed to create a database.
groupis the group the created database will be a part of. This group must already be created or else the request will fail.databaseNameis the name of the newly created database. The request will fail if there is already a database of the specified name created.
Results of successfully creating a database with the Turso API.
databaseIdis the newly created databases id in Turso.databaseNameis the name of the newly created database. This will match the name given to thecreatefunction.hostnameis a value that can be used to make specific requests to that database using theTurso.Dbmodule in this package.
Errors that can happen when attempting to create a database.
CreateErrorDatabaseAlreadyExistshappens when you're trying to create a database whose name already existing in Turso for the group you're making the database in.CreateErrorGroupNotFoundhappens when the group you're trying to create the database for does not exist in the organization.CreateHttpErrorcaptures any other HTTP errors.
Create a new Turso database.
Delete Databases
Arguments for the delete function.
databaseNameis the name of the database you want to delete.
Results of successfully deleting a database.
databaseNameis the name of the deleted database. This should match the name given in thedeletefunction.
Errors that can happen when attempting to delete a database.
DeleteErrorDatabaseNotFoundhappens when the passed database name does not exist yet in Turso.DeleteHttpErrorcaptures any other HTTP errors.
Delete a database in Turso.
Create Database Tokens
Create tokens for a specific database in Turso. These tokens can be used
to query databases with the Turso.Db module.
Arguments needed to create a database token.
databaseNameis the name of the database you want to create the token for.expirationfield is a string representing when the token expires. This must resemble the following format:2w1d30m. If not provided, the token will never expire.authorizationvalue specifies what type of actions the token will be able to take on the database. The default value isFullAccess. See theTokenAuthorizationtype for more options.permissionsrecord has one field:readAttachDatabases. Providing an array of database ids which this token is allowed to attach to a SQL statement with theATTACHkeyword. If not required, an empty array ([]) can be provided as the value.
Represents the type of access a token is allowed to have for the database.
FullAccessallows reading and writing data to the database.ReadOnlyonly allows queries to read data from the database.
Results of successfully creating token for a database.
jwtis aStringrepresenting the created JWT (JavaScipt Web Token).
Create a token for operating on a database in Turso.
Invalidate Database Tokens
Arguments needed to invalidate all tokens for a database.
databaseNameis the database you want to invalid the tokens for.
Errors that can happen when attempting to invalidate a databases tokens.
InvalidateTokensErrorDatabaseNotFoundhappens when the passed database name does not exist yet in Turso.InvalidateTokensHttpErrorcaptures any other HTTP errors.
Invalidate all tokens for the given database name.
When successfull, will invalidate all tokens for the given database, but returns no values.
Get Database Usage
Arguments for the usage function.
databaseNameis the name of the database you want to get usage information forfromis the first date you want to get usage for.tois the last date you want to get usage for.
Both from and to must be ISO 8601 strings.
The specific stats for an individual database.
The results of getting usage information for a database.
databaseIdis the id of the database you're getting usage fortotaUsageis sum of all of theUsageStatsfrom all instances of the given database.instancesis the usage for each specific instance of the database.
Errors that can happen when attempting to retrieve usage information for a database.
UsageErrorInvalidQueryParameterhappens when the passedfromortovalues are not valid ISO 8601 strings.UsageErrorDatabaseNotFoundhappens when the passed database name does not exist yet in Turso.RetrieveHttpErrorcaptures any other HTTP errors.
Get the usage information for a given database.
Get Database Stats
Arguments for the stats function.
databaseNameis the name of the database you want to get stats for.
The results of getting stats for a database.
topQueriesis an array of the queries who have done the most reading and writing of rows for the database.
Errors that can happen when attempting to retrieve stats for a database.
StatsErrorDatabaseNotFoundhappens when the passed database name does not exist in Turso.StatsHttpErrorcaptures any other HTTP errors.
Get stats for a given database.