.. _auto_database_create_new: *CREATE A NEW DATABASE* ======================= Creates a new named database (Datarecord) on the d3VIEW platform with a user-defined schema, optionally pre-populating it with records. If a database with the same name already exists, it can either be reused or deleted and recreated depending on the configured flag. When to use ----------- Tagged: ``create``, ``database``, ``datarecord``, ``db_init``, ``platform``, ``schema``. Inputs ------ .. list-table:: :header-rows: 1 :widths: 20 20 20 20 20 20 * - Label - ID - Type - Default - Required - Description * - Name - db_name - text - — - ✓ - Unique name for the new database; used to identify and look up the Datarecord within the active user's scope. * - Schema - schema - dataset - — - ✓ - Column definitions for the database, provided as a fixed-schema dataset with three columns — id (column machine name), type (one of: text, number, curve, dataset, keyvalue, date, datetime-local, image, video, textarea), and label (human-readable column header). * - Records(optional) - records - dataset - — - - Optional initial rows to insert into the newly created database; each row must conform to the columns defined in schema — leave empty to create an empty database. * - Delete if Exists - delete_if_exists - select - no - ✓ - Controls behaviour when a database with db_name already exists: 'yes' deletes the existing database before creating a fresh one; 'no' (default) reuses the existing database and skips creation. Outputs ------- .. list-table:: :header-rows: 1 :widths: 20 20 20 20 * - Label - ID - Type - Description * - Database Id - database_id - integer - Integer primary-key ID of the newly created (or reused) Datarecord database, suitable for referencing the database in downstream workers. Disciplines ----------- - data.io.sql - platform.workflow .. raw:: html

Auto-generated from platform schema. Worker id: database_create_new. Schema hash: 6be13732b034. Hand-curated docs in workerexamples/ override this page when present.