Connect to MySQL/MariaDB databases, browse schema, run queries, execute DML/DDL, manage saved queries, and insert or update rows.
Every capability exposed by SQL Database, metered per action and guarded by the two-step safety protocol.
add_connectionwriteAdd a new MySQL/MariaDB connection. Tests connectivity before saving.
list_connectionsreadList all saved database connections with their status.
resolve_connection_by_databasereadResolve connection_id for a database or connection name. Use as the first step in automations before run_query/execute_sql, e.g. resolve_connection_by_database(database_name='ijodghbk_test') -> pass the returned connection_id into the next step.
test_connectionreadTest connectivity for an existing saved connection.
select_connectionwriteSwitch the active database connection.
delete_connectiondestructiveDelete a saved database connection permanently.
run_queryreadRun a read-only SQL query (SELECT/WITH/SHOW). PREREQUISITE: you must know the EXACT table name AND column names. If you only know the table name - call get_table_detail(table='name') first to get columns. If you don't know the table name - call list_tables(search='keyword') first. NEVER guess column names. Use execute_sql for INSERT/UPDATE/DELETE/DDL.
get_schemareadGet full schema for ALL tables at once (columns, indexes). WARNING: for databases with >50 tables the response may be large. PREFER: list_tables(search=...) to find a table, then get_table_detail() for its columns. Use get_schema() only when user explicitly asks for the full schema overview.
explain_queryreadRun EXPLAIN on a query to see execution plan.
dry_runreadDry-run a DML statement: execute in transaction, count affected rows, then ROLLBACK.
count_tablereadGet the EXACT row count of a table via SELECT COUNT(*). Use this when the user asks how many rows are in a table - get_schema() returns INFORMATION_SCHEMA estimates which can be wrong. This is the only call that returns a guaranteed-accurate row count.
list_tablesreadSearch for tables by name. Use this FIRST when user mentions a table by name or asks to find a table - returns just table names, very fast, never truncated. Examples: search='tbl' finds all tables starting with 'tbl', search='invoice' finds invoice-related tables. Then call get_table_detail() for column structure of the specific table you found.
get_table_detailreadGet columns, indexes, and foreign keys for ONE specific table. Use after list_tables() to get the structure of a table you found. Returns exact column names and types needed before running run_query().
execute_sqldestructiveExecute a write statement (INSERT, UPDATE, DELETE, REPLACE, ALTER, CREATE, DROP, TRUNCATE). Use this for all database mutations including automation-triggered inserts.
run_editor_sqlwriteRun any SQL from the editor. Auto-detects: SELECT goes to query, DML/DDL goes to execute.
execute_batchdestructiveRun MULTIPLE SQL statements at once, sequentially, in ONE transaction. Use this when the user asks to create a table AND fill it, create several tables, or run a multi-statement script - instead of multiple execute_sql calls (execute_sql rejects multi-statement). Pass the whole script in `sql` (statements separated by ';'). Note: DDL (CREATE/ALTER/DROP) auto-commits and cannot be rolled back; DML is transactional.
nl_to_sqlreadConvert a natural language question to SQL. Automatically fetches schema if needed - use this when user asks a question about data in natural language and you need to generate the SQL query. Then call run_query() with the generated SQL.
list_historyreadList recent query history for the active connection.
save_querywriteSave a query for later use.
list_savedreadList saved queries for the active connection.
run_savedreadRun a previously saved query.
delete_saveddestructiveDelete a saved query.
_pulse_sql_executedwriteInternal side-channel: emit sql.executed after a panel-direct DML so the sidebar schema refreshes. Do not call from chat - for extension-internal use only.
insert_rowwriteInsert a new row into a table. Values as JSON object of column -> value.
update_rowwriteUpdate a single row identified by primary key. Changes as JSON object of column -> new value.
delete_rowdestructiveDelete a single row identified by primary key. Requires confirmation.
delete_rowsdestructiveDelete SEVERAL rows at once by primary key - the batch version of delete_row. Pass table, pk_col and pk_values (list). Requires an explicit confirm=true on a second call; the first call only previews which keys would be deleted. Each row is deleted as its own parameterized statement, so this is NOT one transaction: if some fail, the others still go through and each is reported.
More extensions in Developer Tools ready to enable in one click.
Enable SQL Database in your Imperal workspace in one click - 10,000 free starter credits included.