Skip to content

Server commands (create/drop database, create/drop user) and sqlscript in the HTTP clients' facades #122

Closed

Description

@robfrank

Feedback

A user evaluating the Go driver as a replacement for their hand-written HTTP client reported two gaps:

Server commands: create database and create user exist only through Raw(), with no typed errors, and the application's per-user isolation depends on them. There is also no constant for sqlscript. Once these exist I'll gladly try the driver in place of my HTTP client.

Both gaps are real, and they affect all three HTTP clients, not just Go.

Gap 1: no facade for server commands (POST /api/v1/server, executeServerCommand)

Client Today
Go (go/arcadedb) Server wraps only ListDatabases, Exists, ServerInfo, Health and Ready (server.go). Server commands are reachable only through Server.Raw(), which by design never returns an error on a non-2xx status, so the caller gets no *ArcadeDBError.
Python (arcadedb-driver) No facade method. Only .raw, which crashes on the 200 body (see below).
TypeScript (@arcadedb/driver) No facade method.

Our own e2e suites skip the generated typed call and use ExecuteServerCommandWithBody (Go, go/e2e/main_test.go) or the raw httpx client (Python, e2e/conftest.py) to create their test databases. That alone shows the gap.

Why the generated client is not enough here: the contract declares the 200 body as QueryResponse with an array result, but a real admin command such as create database answers {"result": "ok"} (the known upstream quirk, documented in go/CLAUDE.md and python/CLAUDE.md):

  • Go's typed ExecuteServerCommandWithResponse reports Limit, Returned and Truncated as zero values the wire never carried.
  • Python's generated from_dict raises ValueError.

Each facade method therefore has to decode the body itself, not through the generated model.

Proposed surface (names per language idiom)

Typed methods on Server, each going through the facade's normal error path (checkResponse / ArcadeDBError, so 400/401/403/404/409/5xx all surface as typed errors):

  • CreateDatabase(ctx, name)
  • DropDatabase(ctx, name)
  • CreateUser(ctx, user): name, password, and the per-database group map (databases: {db: group}), serialised into the create user {...} JSON payload so callers don't hand-build it
  • DropUser(ctx, name)
  • ServerCommand(ctx, command): the generic escape hatch, still with typed errors. It returns the decoded result as untyped JSON, because its shape varies by command: "ok" for admin commands, row arrays for list queries / list transactions, and status objects for terminate ....

To decide during design:

  • Should CreateDatabase / CreateUser expose an "already exists" condition distinctly (e.g. an errors.Is-able sentinel or a typed check) if the server's answer allows it reliably? Per-user isolation needs create-if-absent, and the facade must not string-match on an unstable message without saying so. Check what the server actually sends first.
  • Names must be validated or quoted so that a user-supplied database or user name cannot inject a second command into the command string.
  • Whether to also wrap open / close database, set server setting, list queries / terminate query, or leave those to ServerCommand. Suggest: leave them out for now.

Gap 2: sqlscript is missing from the query-language set

Client Today Effect
Go constants SQL, Cypher, Gremlin, GraphQL, Mongo (envelope.go) QueryLanguage("sqlscript") works but is undiscoverable
Python QueryLanguage = Literal["sql", "cypher", "gremlin", "graphql", "mongo"] (facade/data.py) "sqlscript" fails type-checking
TypeScript type QueryLanguage = "sql" | "cypher" | "gremlin" | "graphql" | "mongo" (facade/data.ts) "sqlscript" fails to compile

The contract itself lists sqlscript among the languages a build can run. Fix: add SQLScript / "sqlscript" in all three. While we're at it, decide whether Python and TypeScript should keep a closed set at all. Go deliberately allows any server-understood value through QueryLanguage("..."). An open-but-hinted type (Literal[...] | str in Python, ... | (string & {}) in TypeScript) would stop the next missing language from being a hard block.

Out of scope (possible follow-up)

The gRPC contract already has CreateDatabase, DropDatabase, CreateUser, DeleteUser and ListUsers on ArcadeDbAdminService. The Go gRPC client exposes them only through RawAdmin() (TypeScript and Python gRPC likewise through the raw stubs). gRPC errors are deliberately left unwrapped, so the "typed errors" complaint does not apply in the same way. Revisit if a user asks.

Acceptance

  • Go: Server.CreateDatabase/DropDatabase/CreateUser/DropUser/ServerCommand, unit tests on the fake server (including the {"result":"ok"} body and each error status), e2e coverage. go/e2e stops hand-rolling database creation.
  • Python: the same surface on the sync and async servers. e2e/conftest.py uses it.
  • TypeScript: the same surface. The e2e setup uses it.
  • sqlscript in all three language sets, with a unit test that a script reaches the wire as "language": "sqlscript".
  • READMEs: the server-command section, the root-only requirement, why ServerCommand returns untyped JSON, and the injection/validation rule. Update go/CLAUDE.md / python/CLAUDE.md where they currently say "no facade method wraps the endpoint".

Activity

  1. added
    enhancement
    typescript
    python
    go
    http-driver
    on Oct 15, 2026
  2. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    Correction to the proposed surface: user management should not go through the create user {...} command string. The contract has dedicated REST endpoints, all root-only:

    op method path notable statuses
    createUser POST /api/v1/server/users 201, 409 (already exists), 400 (e.g. password < 8 chars)
    updateUser PUT /api/v1/server/users?name= 200
    deleteUser DELETE /api/v1/server/users?name= 200
    listUsers GET /api/v1/server/users 200

    So CreateUser / UpdateUser / DropUser / ListUsers wrap these. They take a structured CreateUserRequest (no command-string injection to guard against), and 409 gives create-if-absent a reliable signal without string-matching. Those are exactly the questions the issue left open. Same thing for groups (listGroups, createOrUpdateGroup, deleteGroup on /api/v1/server/groups), which per-user isolation will likely need too, so they belong in this issue.

    Databases have no dedicated endpoint, so CreateDatabase / DropDatabase still go through POST /api/v1/server with the {"result":"ok"} handling and name validation described above.

  3. self-assigned this
    on Oct 15, 2026
  4. added
    in progress
    on Oct 15, 2026
  5. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    Correction to my comment above: 409 is not what a duplicate user gets. I measured it against a live 26.11.1-SNAPSHOT server while implementing the Go part:

    case contract real server
    POST /api/v1/server/users, name already exists 409 403 "Security error", detail: "User '<name>' already exists"
    create database, name already exists (200/400 only) 400 "Cannot execute command", detail: "Database '<name>' already exists"

    The 403 comes from ServerSecurity.createUserClusterWide throwing ServerSecurityException, which AbstractServerHttpHandler maps to 403, the same status a non-root caller gets. So 403 cannot be read as "already exists", and create-if-absent still needs a look first (ListUsers / Exists). The Go facade documents this and does not classify either case, and e2e/admin_test.go pins both statuses. The 403-vs-409 mismatch is an upstream contract/server disagreement.

  6. added a commit that references this issue on Oct 15, 2026
  7. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    The Go HTTP client part landed in #126 (github.com/ArcadeData/arcadedb-drivers/go/arcadedb). Creating and dropping databases, managing users and groups, and running any other server command no longer need Raw(), and every failure now comes back as an *ArcadeDBError like the rest of the client. SQLScript is now a named language constant. It is on main now, and you can try it before the next release with go get github.com/ArcadeData/arcadedb-drivers/go/arcadedb@main.

    • Go: server commands (create/drop database, any command): done
    • Go: users and groups: done
    • Go: sqlscript constant: done
    • Python: not started
    • TypeScript: not started

    Still open:


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. added a commit that references this issue on Oct 15, 2026
  9. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    Update: upstream fixed ArcadeData/arcadedb#10073 in ArcadeData/arcadedb#10076. A duplicate user now gets 409, so a 409 from creating a user can be treated as "already there". Users who aren't root still get 403. #129 updates the Go client, and #128 (Python) already uses 409. A duplicate database still gets 400.

  10. added a commit that references this issue on Oct 15, 2026
  11. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    The Python HTTP client part landed in #128 (arcadedb-driver, both sync and async). ArcadeDBServer and AsyncArcadeDBServer can now create and drop databases, manage users and groups, and run any other server command. Every failure raises ArcadeDBError, and "sqlscript" is now accepted as a query language (until now it failed type-checking).

    Still open: the TypeScript part, which is why this issue stays open.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  12. added a commit that references this issue on Oct 15, 2026
  13. robfrank commented on Oct 15, 2026

    @robfrank
    ContributorAuthor

    Done in all three HTTP clients. Creating and dropping databases, managing users and groups, and running any other server command now go through the facade with typed errors, and sqlscript is a supported query language:

    A duplicate user gets 409 (since ArcadeData/arcadedb#10076; older servers answer 403), so it can be treated as "already there" when creating a user only if it's missing. A duplicate database gets 400, with the reason only in detail; call exists first if you want to create a database only when it's missing. All of this is on main and goes out in the next release; Go users can try it now with go get github.com/ArcadeData/arcadedb-drivers/go/arcadedb@main.

    Still open: letting the query-language type accept any string in Python and TypeScript, as this issue suggested, was deliberately not done; Go already accepts any value. Related follow-ups are #123 (login and API tokens), #124 (listing and stopping running queries) and #125 (PromQL label values).


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  14. removed
    in progress
    on Oct 15, 2026
  15. added a commit that references this issue on Oct 15, 2026
  16. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgohttp-driverpythontypescript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions