---
sidebar_position: 2

description: Create table and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Admonition from '@theme/Admonition';

# Create table
 Creates an empty table in the database



<Tabs>
  <TabItem value="params" label="Parameters" default>

`Function CreateTable(Val Table, Val ColoumnsStruct, Val Connection = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Table | --table | String | &#x2714; | Table name |
  | ColoumnsStruct | --cols | Structure Of KeyAndValue | &#x2714; | Column structure: Key > Name, Value > Data type |
  | Connection | --db | String, Arbitrary | &#x2716; | Existing connection or database path |


<div className="return-value-note">
  <div className="return-value-note__title">Returns</div>
  <div className="return-value-note__value">
 Map Of KeyAndValue - Result of query execution
  </div>
</div>
  
  </TabItem>
  <TabItem value="extended" label={<span>Advanced call{' '}<a href="/docs/Start/Advanced-call" target="_blank" rel="noreferrer" title="About advanced call" onClick={(e) => e.stopPropagation()}>?</a></span>}>

  | Parameter | Description |
  |---|---|
  | addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
  | dontwait | Creates a background job and returns its data (for 1C and OneScript only) |


  </TabItem>
</Tabs>



```bsl title="1C:Enterprise/OneScript code example"
    Base  = "/tmp/vnnmoosn.qqb.sqlite";
    Table = "test";

    ColoumnsStruct = New Structure;
    ColoumnsStruct.Insert("id"        , "INTEGER PRIMARY KEY");
    ColoumnsStruct.Insert("name"      , "TEXT");
    ColoumnsStruct.Insert("age"       , "INTEGER");
    ColoumnsStruct.Insert("salary"    , "REAL");
    ColoumnsStruct.Insert("is_active" , "BOOLEAN");
    ColoumnsStruct.Insert("created_at", "DATETIME");
    ColoumnsStruct.Insert("data"      , "BLOB");

    Result = OPI_SQLite.CreateTable(Table, ColoumnsStruct, Base);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint sqlite CreateTable \
              --table "test1" \
              --cols "{'id':'INTEGER PRIMARY KEY','[An obscure column]':'TEXT'}" \
              --db "/tmp/v3fibjxn.cs0.sqlite"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint sqlite CreateTable ^
              --table "test1" ^
              --cols "{'id':'INTEGER PRIMARY KEY','[An obscure column]':'TEXT'}" ^
              --db "/tmp/v3fibjxn.cs0.sqlite"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "result": true
}
```
