Bỏ qua, tới nội dung
Dymini Panel
v0.18.1
Mục lục
Bạn đang xem tài liệu của v0.18.1.Xem bản mới nhất

Databases

Trong trang này

Managed databases and their lifecycle

List database engines and versions

GET/api/v1/database-engines

Phản hồi

  • 200 List database engines and versionsDatabaseEngineView[]
    • default_portinteger (int32)bắt buộc
    • enginestringbắt buộc
    • versionsstring[]bắt buộc

Create a database

POST/api/v1/environments/{id}/databases

Nội dung gửi lênapplication/json

CreateDatabase

  • databasestring | null
  • enginestringbắt buộc

    postgres, mysql, mariadb, mongo, or redis.

  • memory_bytesinteger | null (int64)
  • namestringbắt buộc
  • nano_cpusinteger | null (int64)
  • public_portinteger | null (int32)

    Publish the database port on the host. Omit to keep it internal.

  • server_idstring (uuid)bắt buộc
  • startboolean | null

    Start the container right away. Defaults to true.

  • usernamestring | null
  • versionstringbắt buộc

Phản hồi

  • 201 Create a databaseServiceView
    • created_atstring (date-time)bắt buộc
    • environment_idstring (uuid)bắt buộc
    • idstring (uuid)bắt buộc
    • kindstringbắt buộc
    • namestringbắt buộc
    • server_idstring (uuid)bắt buộc
    • specanybắt buộc
    • statusstringbắt buộc

Reveal the connection string (admin)

GET/api/v1/services/{id}/connection

Phản hồi

  • 200 Reveal the connection string (admin)ConnectionView
    • databasestringbắt buộc
    • enginestringbắt buộc
    • hoststringbắt buộc
    • internal_urlstringbắt buộc
    • passwordstringbắt buộc
    • portinteger (int32)bắt buộc
    • public_urlstring | null
    • usernamestringbắt buộc

Update database ports and limits

PATCH/api/v1/services/{id}/database

Nội dung gửi lênapplication/json

UpdateDatabase

  • clear_public_portboolean | null
  • memory_bytesinteger | null (int64)
  • nano_cpusinteger | null (int64)
  • public_portinteger | null (int32)

Phản hồi

  • 200 Update database ports and limitsServiceView
    • created_atstring (date-time)bắt buộc
    • environment_idstring (uuid)bắt buộc
    • idstring (uuid)bắt buộc
    • kindstringbắt buộc
    • namestringbắt buộc
    • server_idstring (uuid)bắt buộc
    • specanybắt buộc
    • statusstringbắt buộc

Delete a database (optionally its volume)

DELETE/api/v1/services/{id}/database

Phản hồi

  • 204 Delete a database (optionally its volume)

List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)

GET/api/v1/services/{id}/db/activity

Phản hồi

  • 200 List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)DbSession[]
    • blocked_bystring | null
    • clientstring | null
    • databasestring | null
    • duration_secsinteger | null (int64)
    • idstringbắt buộc
    • querystring | null
    • statestring | null
    • user_namestring | null
    • waiting_onstring | null

Cancel the running statement of a session; terminate=true closes the whole session. The session id comes from …/db/activity. Needs write access and, for agent grants, agent_access=read_write

POST/api/v1/services/{id}/db/activity/{session}/cancel

Nội dung gửi lênapplication/json

DbCancelRequest

  • terminateboolean | null

    Close the whole session instead of cancelling its current statement.

Phản hồi

  • 200 Cancel the running statement of a session; terminate=true closes the whole session. The session id comes from …/db/activity. Needs write access and, for agent grants, agent_access=read_writeDbCancelResult
    • okbooleanbắt buộc

      The server accepted the request.

    • sessionstringbắt buộc
    • terminatedbooleanbắt buộc

Run SQL that changes data or schema (INSERT, UPDATE, DELETE, CREATE INDEX [CONCURRENTLY], ALTER, VACUUM, ANALYZE, …). Several statements separated by ';' run in one transaction when the engine allows it (transactional=true: all or nothing). Needs write access and, for agent grants, agent_access=read_write. DROP, TRUNCATE, ALTER … DROP and DELETE/UPDATE without WHERE return 409 confirmation_required until confirm_destructive=true. Client commands (\d, \!, SOURCE, …), COPY, LOAD DATA and server file access are refused

POST/api/v1/services/{id}/db/execute

Nội dung gửi lênapplication/json

DbExecuteRequest

  • confirm_destructiveboolean | null

    Required when a statement drops, truncates, or changes every row.

  • max_rowsinteger | null (int64)
  • sqlstringbắt buộc

    One or more statements separated by ;.

  • timeout_secsinteger | null (int64)

Phản hồi

  • 200 Run SQL that changes data or schema (INSERT, UPDATE, DELETE, CREATE INDEX [CONCURRENTLY], ALTER, VACUUM, ANALYZE, …). Several statements separated by ';' run in one transaction when the engine allows it (transactional=true: all or nothing). Needs write access and, for agent grants, agent_access=read_write. DROP, TRUNCATE, ALTER … DROP and DELETE/UPDATE without WHERE return 409 confirmation_required until confirm_destructive=true. Client commands (\d, \!, SOURCE, …), COPY, LOAD DATA and server file access are refusedDbExecuteResponse
    • elapsed_msinteger (int64)bắt buộc
    • statementsDbStatementResult[]bắt buộc
      DbStatementResult[]
      • affected_rowsinteger | null (int64)
      • indexintegerbắt buộc
      • kindstringbắt buộc

        read or write.

      • resultQueryResult | null
        QueryResult | null

        Một trong:

        • QueryResult
          • columnsstring[]bắt buộc
          • rowsstring | null[][]bắt buộc
          • truncatedbooleanbắt buộc

            More rows existed than were returned.

        • null
      • statementstringbắt buộc
      • tagstring | null

        Command tag such as UPDATE 3.

    • transactionalbooleanbắt buộc

      All statements ran in one transaction (all applied or none).

Show the query plan of one statement. Body: sql (without EXPLAIN); analyze=true runs it and reports real timings (read statements only). Use it to check that a new index is used

POST/api/v1/services/{id}/db/explain

Nội dung gửi lênapplication/json

DbExplainRequest

  • analyzeboolean | null

    Run it and report real timings. Only allowed for read statements.

  • sqlstringbắt buộc

    The statement to explain.

Phản hồi

  • 200 Show the query plan of one statement. Body: sql (without EXPLAIN); analyze=true runs it and reports real timings (read statements only). Use it to check that a new index is usedDbQueryResponse
    • elapsed_msinteger (int64)bắt buộc
    • resultQueryResultbắt buộc

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]bắt buộc
      • rowsstring | null[][]bắt buộc
      • truncatedbooleanbắt buộc

        More rows existed than were returned.

    • statementstringbắt buộc

      The statement with string literals hidden.

Run health checks and get findings, each with a suggested SQL statement or Redis command: missing, unused, duplicate or invalid indexes, foreign keys without index, tables without primary key, dead rows, long-running or blocked sessions, cache hit ratio, connection and memory limits, failed persistence, slow queries. Review a suggestion, then run it with …/db/execute or …/db/redis/execute

GET/api/v1/services/{id}/db/insights

Phản hồi

  • 200 Run health checks and get findings, each with a suggested SQL statement or Redis command: missing, unused, duplicate or invalid indexes, foreign keys without index, tables without primary key, dead rows, long-running or blocked sessions, cache hit ratio, connection and memory limits, failed persistence, slow queries. Review a suggestion, then run it with …/db/execute or …/db/redis/executeDbInsights
    • checked_atstring (date-time)bắt buộc
    • enginestringbắt buộc
    • findingsDbFinding[]bắt buộc

      Critical first, then warnings, then information.

      DbFinding[]
      • categorystringbắt buộc

        performance, indexes, maintenance, capacity, reliability, or schema.

      • checkstringbắt buộc

        Stable machine name of the check, e.g. unused_index.

      • detailstringbắt buộc
      • objectstring | null

        Table, index, session or setting the finding is about.

      • severitystringbắt buộc

        critical, warning, or info.

      • suggestionstring | null

        SQL or Redis command that addresses it. Review before running it with the execute endpoint.

      • titlestringbắt buộc
    • skippedstring[]bắt buộc

      Checks that could not run, with the reason.

    • slow_queriesQueryResult | null
      QueryResult | null

      Một trong:

      • QueryResult
        • columnsstring[]bắt buộc
        • rowsstring | null[][]bắt buộc
        • truncatedbooleanbắt buộc

          More rows existed than were returned.

      • null

Read one Redis key: type, TTL, memory, length and value (first 64 KiB of a string, or the first `limit` elements). Query: key (required), db (0-15), limit (1-1000, default 200)

GET/api/v1/services/{id}/db/key

Phản hồi

  • 200 Read one Redis key: type, TTL, memory, length and value (first 64 KiB of a string, or the first `limit` elements). Query: key (required), db (0-15), limit (1-1000, default 200)DbKeyDetail
    • keystringbắt buộc
    • lengthinteger | null (int64)

      Elements (or bytes for strings) in the key.

    • memory_bytesinteger | null (int64)
    • truncatedbooleanbắt buộc
    • ttl_msinteger (int64)bắt buộc
    • typestringbắt buộc
    • valueobjectbắt buộc

      String value (first 64 KiB), list/set items, [field, value] / [member, score] pairs, or [id, [[field, value]]] stream entries.

Scan Redis keys with type, TTL and memory, without blocking the server. Query: pattern (glob, default *), cursor (start with 0, then pass the returned cursor until it is 0), count (1-1000 per step, default 200), type (string, list, set, zset, hash, stream), db (0-15)

GET/api/v1/services/{id}/db/keys

Phản hồi

  • 200 Scan Redis keys with type, TTL and memory, without blocking the server. Query: pattern (glob, default *), cursor (start with 0, then pass the returned cursor until it is 0), count (1-1000 per step, default 200), type (string, list, set, zset, hash, stream), db (0-15)DbKeyPage
    • cursorstringbắt buộc

      Pass back as cursor for the next page; 0 means the scan is complete.

    • keysDbKey[]bắt buộc
      DbKey[]
      • keystringbắt buộc
      • memory_bytesinteger (int64)bắt buộc
      • ttl_msinteger (int64)bắt buộc

        Milliseconds to expiry; -1 without expiry.

      • typestringbắt buộc

Database health numbers for Postgres, MySQL, MariaDB or Redis: connections, size, cache hit ratio, throughput counters, memory, uptime. Allowed whatever agent_access is. History for charts: GET /api/v1/metrics?service_id=<id>&metrics=db_connections,db_tps,db_ops_per_sec,db_cache_hit_ratio,db_size_bytes,db_memory_bytes

GET/api/v1/services/{id}/db/overview

Phản hồi

  • 200 Database health numbers for Postgres, MySQL, MariaDB or Redis: connections, size, cache hit ratio, throughput counters, memory, uptime. Allowed whatever agent_access is. History for charts: GET /api/v1/metrics?service_id=<id>&metrics=db_connections,db_tps,db_ops_per_sec,db_cache_hit_ratio,db_size_bytes,db_memory_bytesDbOverview
    • agent_accessstringbắt buộc
    • chart_metricsstring[]bắt buộc

      Metric names with history for this engine: pass them to GET /api/v1/metrics?service_id=…&metrics=… (at most 8 per call).

    • checked_atstring (date-time)bắt buộc
    • enginestringbắt buộc
    • server_versionstring | null

      Version reported by the running server.

    • statsDbStat[]bắt buộc
      DbStat[]
      • keystringbắt buộc

        Stable machine name, e.g. cache_hit_ratio.

      • labelstringbắt buộc
      • unitstringbắt buộc

        count, bytes, percent, seconds, ms, or ratio.

      • valuenumber (double)bắt buộc
    • versionstringbắt buộc

Run one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE) in a read-only session and get columns and rows (values are text or null). Body: sql; optional max_rows and timeout_secs, capped by the settings. Statements that change anything are refused with write_statement: use …/db/execute

POST/api/v1/services/{id}/db/query

Nội dung gửi lênapplication/json

DbQueryRequest

  • max_rowsinteger | null (int64)
  • sqlstringbắt buộc

    One read-only statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE).

  • timeout_secsinteger | null (int64)

Phản hồi

  • 200 Run one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE) in a read-only session and get columns and rows (values are text or null). Body: sql; optional max_rows and timeout_secs, capped by the settings. Statements that change anything are refused with write_statement: use …/db/executeDbQueryResponse
    • elapsed_msinteger (int64)bắt buộc
    • resultQueryResultbắt buộc

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]bắt buộc
      • rowsstring | null[][]bắt buộc
      • truncatedbooleanbắt buộc

        More rows existed than were returned.

    • statementstringbắt buộc

      The statement with string literals hidden.

Run a Redis command that changes data or settings (SET, DEL, EXPIRE, HSET, LPUSH, ZADD, CONFIG SET maxmemory, SLOWLOG RESET, EVAL, …). Needs write access and, for agent grants, agent_access=read_write. FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE need confirm_destructive=true

POST/api/v1/services/{id}/db/redis/execute

Nội dung gửi lênapplication/json

DbRedisRequest

  • argsstring[]

    Arguments, e.g. ["HGETALL", "user:1"]. Preferred over command.

  • commandstring | null

    A command line as typed in redis-cli, e.g. SET "a key" value EX 60.

  • confirm_destructiveboolean | null

    Required for FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE.

  • dbinteger | null (int32)

    Logical database, 0 to 15. Defaults to 0.

Phản hồi

  • 200 Run a Redis command that changes data or settings (SET, DEL, EXPIRE, HSET, LPUSH, ZADD, CONFIG SET maxmemory, SLOWLOG RESET, EVAL, …). Needs write access and, for agent grants, agent_access=read_write. FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE need confirm_destructive=trueDbRedisResponse
    • commandstringbắt buộc
    • elapsed_msinteger (int64)bắt buộc
    • kindstringbắt buộc

      read or write.

    • replyobjectbắt buộc

      The reply as JSON (strings, numbers, arrays, maps, or null).

Run one read-only Redis command (GET, MGET, HGETALL, LRANGE, SMEMBERS, ZRANGE, SCAN, TTL, TYPE, INFO, SLOWLOG GET, MEMORY USAGE, CONFIG GET, …). Body: args array (preferred), or a command line; db 0-15. KEYS, MONITOR, SUBSCRIBE, blocking pops, SELECT and MULTI are refused with the alternative to use

POST/api/v1/services/{id}/db/redis/query

Nội dung gửi lênapplication/json

DbRedisRequest

  • argsstring[]

    Arguments, e.g. ["HGETALL", "user:1"]. Preferred over command.

  • commandstring | null

    A command line as typed in redis-cli, e.g. SET "a key" value EX 60.

  • confirm_destructiveboolean | null

    Required for FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE.

  • dbinteger | null (int32)

    Logical database, 0 to 15. Defaults to 0.

Phản hồi

  • 200 Run one read-only Redis command (GET, MGET, HGETALL, LRANGE, SMEMBERS, ZRANGE, SCAN, TTL, TYPE, INFO, SLOWLOG GET, MEMORY USAGE, CONFIG GET, …). Body: args array (preferred), or a command line; db 0-15. KEYS, MONITOR, SUBSCRIBE, blocking pops, SELECT and MULTI are refused with the alternative to useDbRedisResponse
    • commandstringbắt buộc
    • elapsed_msinteger (int64)bắt buộc
    • kindstringbắt buộc

      read or write.

    • replyobjectbắt buộc

      The reply as JSON (strings, numbers, arrays, maps, or null).

Browse rows of one table. Query: name (required), schema, limit (default 100, at most max_rows), offset, order_by (column name), order (asc|desc). result.truncated=true means more rows follow; raise offset

GET/api/v1/services/{id}/db/rows

Phản hồi

  • 200 Browse rows of one table. Query: name (required), schema, limit (default 100, at most max_rows), offset, order_by (column name), order (asc|desc). result.truncated=true means more rows follow; raise offsetDbQueryResponse
    • elapsed_msinteger (int64)bắt buộc
    • resultQueryResultbắt buộc

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]bắt buộc
      • rowsstring | null[][]bắt buộc
      • truncatedbooleanbắt buộc

        More rows existed than were returned.

    • statementstringbắt buộc

      The statement with string literals hidden.

Read the database console settings of a database service: agent_access (off, read, read_write) is what agent grants (AI agents, the iOS app) may do with its data; max_rows and timeout_secs are the per-query defaults and ceilings

GET/api/v1/services/{id}/db/settings

Phản hồi

  • 200 Read the database console settings of a database service: agent_access (off, read, read_write) is what agent grants (AI agents, the iOS app) may do with its data; max_rows and timeout_secs are the per-query defaults and ceilingsDbConsoleSettings
    • agent_accessstringbắt buộc

      off, read, or read_write: what AI agents and apps signed in with an agent grant may do with this database's data.

    • max_rowsinteger (int32)bắt buộc

      Default and maximum rows one query returns (1 to 5000).

    • timeout_secsinteger (int32)bắt buộc

      Default and maximum seconds one statement may run (1 to 300).

    • updated_atstring | null (date-time)

Change the database console settings (admin): agent_access off|read|read_write, max_rows 1-5000, timeout_secs 1-300. Agent grants may lower agent_access but never raise it

PUT/api/v1/services/{id}/db/settings

Nội dung gửi lênapplication/json

SaveDbConsoleSettings

  • agent_accessstring | null

    off, read, or read_write. Agents may only lower it.

  • max_rowsinteger | null (int32)
  • timeout_secsinteger | null (int32)

Phản hồi

  • 200 Change the database console settings (admin): agent_access off|read|read_write, max_rows 1-5000, timeout_secs 1-300. Agent grants may lower agent_access but never raise itDbConsoleSettings
    • agent_accessstringbắt buộc

      off, read, or read_write: what AI agents and apps signed in with an agent grant may do with this database's data.

    • max_rowsinteger (int32)bắt buộc

      Default and maximum rows one query returns (1 to 5000).

    • timeout_secsinteger (int32)bắt buộc

      Default and maximum seconds one statement may run (1 to 300).

    • updated_atstring | null (date-time)

Describe one table: columns (type, nullable, default) and indexes (definition, size, scans). Query: name (required), schema (default public on Postgres; the service database on MySQL/MariaDB)

GET/api/v1/services/{id}/db/table

Phản hồi

  • 200 Describe one table: columns (type, nullable, default) and indexes (definition, size, scans). Query: name (required), schema (default public on Postgres; the service database on MySQL/MariaDB)DbTableDetail
    • columnsDbColumn[]bắt buộc
      DbColumn[]
      • commentstring | null
      • data_typestringbắt buộc
      • default_valuestring | null
      • namestringbắt buộc
      • nullablebooleanbắt buộc
    • indexesDbIndex[]bắt buộc
      DbIndex[]
      • definitionstringbắt buộc
      • is_primarybooleanbắt buộc
      • is_uniquebooleanbắt buộc
      • is_validbooleanbắt buộc
      • namestringbắt buộc
      • scansinteger | null (int64)

        Index scans since statistics were reset (Postgres).

      • size_bytesinteger | null (int64)
    • namestringbắt buộc
    • schemastringbắt buộc

List tables and views of a SQL database with row estimates and sizes

GET/api/v1/services/{id}/db/tables

Phản hồi

  • 200 List tables and views of a SQL database with row estimates and sizesDbTable[]
    • index_bytesinteger | null (int64)
    • kindstringbắt buộc

      table, view, materialized view, base table, …

    • namestringbắt buộc
    • rows_estimateinteger | null (int64)
    • schemastringbắt buộc
    • total_bytesinteger | null (int64)

Restart a service

POST/api/v1/services/{id}/restart

Phản hồi

  • 200 Restart a serviceLifecycleView
    • container_idstring | null
    • statusstringbắt buộc

Start a service

POST/api/v1/services/{id}/start

Phản hồi

  • 200 Start a serviceLifecycleView
    • container_idstring | null
    • statusstringbắt buộc

Stop a service

POST/api/v1/services/{id}/stop

Phản hồi

  • 200 Stop a serviceLifecycleView
    • container_idstring | null
    • statusstringbắt buộc