You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/actions-singlestore/index.md
+45-20Lines changed: 45 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,37 +27,62 @@ This destination is maintained by SingleStore. For any issues with the destinati
27
27
{% include components/actions-fields.html %}
28
28
29
29
### Finding your SingleStore connection settings
30
-
To find your SingleStore connection settings, head to the [SingleStore Portal](https://portal.singlestore.com){:target="_blank”} and complete the following steps:
31
-
1. Select **Deployments**.
32
-
2. Choose your Workspace and Database within the list of Deployments
33
-
3. From the Connect dropdown, select **Connect to your own app**. SingleStore will display the the key settings you need to connect your SingleStore database to Segment.
30
+
To connect Segment to SingleStore, use the SingleStore Data API (typically on port 443). Follow these steps to enable and locate your Data API connection settings:
31
+
32
+
1. Head to the [SingleStore Portal](https://portal.singlestore.com){:target="_blank"}.
33
+
2. Select **Deployments**.
34
+
3. Choose your Workspace and Database within the list of Deployments
35
+
4. From the Connect dropdown, select **Connect to your own app**. SingleStore will display the the key settings you need to connect your SingleStore database to Segment.
36
+
37
+
**Note:**
38
+
- The Data API is enabled by default for all SingleStore Cloud workspaces.
39
+
- Segment always uses the Data API (typically on port 443).
40
+
- If you are using a self-hosted or development SingleStore deployment (such as the SingleStore-dev image), the Data API may run on a different port. Refer to your deployment’s documentation or settings to confirm the correct port.
41
+
42
+
For more details, see the [SingleStore Data API documentation](https://docs.singlestore.com/cloud/reference/data-api/){:target="_blank"}.
34
43
35
44
## Database structure
36
-
Segment creates a table called `segment_raw_data` and writes data to your SingleStore database using the following schema:
45
+
Segment writes data to your specified table in SingleStore (by default, this is `segment_data`) using the following schema:
37
46
38
47
| Column | Type | Description |
39
48
| -------- | ------ | ----------- |
40
-
|`message`| JSON (utf8_bin) | The entire message received from Segment, in JSON format |
41
-
|`timestamp`| datetime | The timestamp of when the event was generated |
42
-
|`event`| VARCHAR(255) | The event name (for Track events) |
43
-
|`messageId`| VARCHAR(255) | The unique identifier of the event to ensure there is no duplication |
44
-
|`type`| VARCHAR(255) | The type of the event (for example, Identify, Track, Page, Group) |
45
-
46
-
47
-
### Accessing nested data
48
-
To query specific data from the Segment event within SingleStore, you can de-reference the JSON pointer within the message column. For example:
49
+
|`messageId`| TEXT | A unique identifier for the event to ensure there is no duplication. |
50
+
|`timestamp`| Datetime(6) | The timestamp of when the event was generated |
51
+
|`type`| TEXT | The type of the event (e.g., "track", "identify", "page", "screen", "group", "alias"). |
52
+
|`event`| TEXT | The name of the event. Only required for "track" events. |
53
+
|`name`| TEXT | The name of the page or screen. |
54
+
|`properties`| JSON | The properties of the track, page or screen event. |
55
+
|`userId`| TEXT | The user ID associated with the event. |
56
+
|`anonymousId`| TEXT | The anonymous ID associated with the event. |
57
+
|`groupId`| TEXT | The group ID associated with the event. |
58
+
|`traits`| JSON | The traits of the user associated with the event. |
59
+
|`context`| JSON | The context of the event. Contains user environment information. |
60
+
61
+
62
+
### Accessing data
63
+
To query specific data from the Segment event within SingleStore, you can select columns directly. For example, to retrieve the `properties` object:
49
64
50
65
```sql
51
-
SELECTmessage::properties FROMsegment_raw_data;
66
+
SELECT properties FROMyour_table_name;
52
67
```
53
68
54
-
This query retrieves the properties object from the JSON message, allowing you to work with nested event data.
69
+
This query retrieves the `properties` object from the specified table, allowing you to work with event data.
55
70
56
71
## Troubleshooting
57
72
73
+
> **Note:**
74
+
> The SingleStore Data API has a limit of 1MB per request. If a batch of events sent by Segment exceeds this limit, you may see an error similar to:
75
+
>
76
+
> ```
77
+
> Error reading request body: http: request body too large
78
+
> ```
79
+
>
80
+
> If you encounter this error, reduce the batch size in your Segment destination settings.
81
+
82
+
58
83
### Connection Errors
59
84
If you're unable to connect to the SingleStore database:
60
-
* Verify that the Host and Port are correct.
85
+
* Verify that the credentials are correct.
61
86
* Ensure that your SingleStore database is accessible from Segment’s servers.
62
87
* Check firewall settings and network configurations.
63
88
@@ -67,20 +92,20 @@ If you encounter authentication errors when Segment attempts to connect:
67
92
* Ensure that the user has the necessary permissions to write to the database.
68
93
69
94
### Data Not Appearing in SingleStore
70
-
If events are not recorded in the `segment_raw_data` table:
95
+
If events are not recorded in the specified table:
71
96
* Verify that your sources are correctly sending data to Segment.
72
97
* Check the event types to ensure they are supported.
73
98
* Review your SingleStore database logs for any errors.
74
99
75
100
## Frequently Asked Questions
76
101
### Can I customize the schema used in SingleStore?
77
102
78
-
By default, the mappings store the complete raw Segment events in the `segment_raw_data` table. If you prefer, within the mapping, you can choose to selectively include or exclude specific fields to be sent and written into SingleStore.
103
+
By default, the mapping stores all fields from the Segment event in separate columns in the `segment_data` table. If you prefer, you can customize the mapping to selectively include or exclude specific fields to be sent and written into SingleStore.
79
104
80
105
### How does SingleStore handle data types from Segment?
81
106
82
107
All event data is stored natively as JSON in the message column. This allows for flexible schema management and easy access to nested properties using SQL queries. SingleStore's ability to dynamically and quickly parse the JSON allows all types of complex events to be queried or used in notebooks.
83
108
84
109
### Is the data ingestion process real-time?
85
110
86
-
Yes, Segment forwards data to SingleStore in real-time, enabling immediate analysis and action on your customer data. Generally data is available in the SingleStore database within a few seconds of Segment sending the event.
111
+
Yes, Segment forwards data to SingleStore in near real-time, enabling immediate analysis and action on your customer data. Generally, data is available in the SingleStore database within approximately 30 seconds of Segment sending the event.
0 commit comments