# INSERT INTO ENTITY

## Syntax <a href="#synopsis" id="synopsis"></a>

{% code overflow="wrap" %}

```sql
INSERT INTO ENTITY entity_name [IN STORE store_name] [KEY(json_string)] VALUE (json_string);
```

{% endcode %}

## Description <a href="#description" id="description"></a>

For an existing entity, `INSERT INTO ENTITY` inserts a JSON string provided in the VALUE clause into the the entity's value field, and optionally writes the JSON string in the **KEY** clause into its key field. The command processes and inserts exactly one JSON record per execution.

{% hint style="info" %}
`INSERT INTO ENTITY` supports only Kafka topics and Kinesis data stream as the sink entity.
{% endhint %}

### Arguments <a href="#parameters" id="parameters"></a>

#### entity\_name

This specifies the name of the entity to add the json string to. For case-sensitive names, the name must be wrapped in double quotes; otherwise, the lowercase name will be used.

#### store\_name

The Kafka or Kinesis store (topic/stream) to which the record will be published.

#### **json\_string**

The JSON string to be inserted into the entity.

## Examples

#### Insert into an entity in a given Store

{% code overflow="wrap" %}

```sql
INSERT INTO ENTITY users IN STORE kafkaStroe  KEY('{"userid": "User_7"}') VALUE('{"registertime": 1753311127306,"userid": "User_7","regionid": "Region_1","gender": "OTHER","interests": ["News","Travel"],"contactinfo": {"phone": "6502215368","city": "San Carlos","state": "CA","zipcode": "94070"}') ;    
```

{% endcode %}

#### Insert only into the "value" of a topic in the default Kafka store

{% code overflow="wrap" %}

```sql
INSERT INTO ENTITY users VALUE('{"registertime": 1753311127306,"userid": "User_7","regionid": "Region_1","gender": "OTHER","interests": ["News","Travel"],"contactinfo": {"phone": "6502215368","city": "San Carlos","state": "CA","zipcode": "94070"}') ;    
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/query/insert-into-entity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
