questdb / questdb

QuestDB is an open source time-series database for fast ingest and SQL queries
https://questdb.io
Apache License 2.0
14.64k stars 1.19k forks source link

Add param to /imp endpoint to throw error if targeted table does not already exist #4089

Closed nwoolmer closed 10 months ago

nwoolmer commented 10 months ago

Is your feature request related to a problem?

/exec and Postgres inserts (should?) error already if the table does not exist. ILP will auto create tables, but I think this feature can be disabled so it only writes to tables that exist.

/imp endpoint has no setting to prevent creating a table. You can, however, send a schema alongside the data.

Rather than having to send a schema with each request, it would be useful to force an error using a flag to disable table creation. This means you could create the table once ahead-of-time (as part of provisioning) and enforce that tables are made up-front, without having to send a schema with every request, or check the table exists first.

The use case is for append (i.e batched text submissions), though this could be used for overwrite requests too.

Describe the solution you'd like.

A query parameter:

?&create_table={true/false} (or a better name) Defaults to true When false, the import request is rejected with an error indicating that the table does not exist.

Describe alternatives you've considered.

Sending schema with every request (possible, but a bigger change than just adding a bool flag to each request) Using /exec (not ideal, sending just CSV format is convenient) Swapping to other inserts (on the todo list)

Full Name:

nwoolmer

Affiliation:

SS

Additional context

No response

nwoolmer commented 10 months ago

PR here: https://github.com/questdb/questdb/pull/4108

nwoolmer commented 10 months ago

PR merged and documented.