From f1af0b26966454d2ec583ac94789b77ee341ffec Mon Sep 17 00:00:00 2001 From: Parth Sharma Date: Thu, 31 Jul 2025 16:30:49 +0530 Subject: [PATCH 1/3] changed doc info --- .../catalog/actions-singlestore/index.md | 65 +++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/src/connections/destinations/catalog/actions-singlestore/index.md b/src/connections/destinations/catalog/actions-singlestore/index.md index bf2600daab..612e16eafb 100644 --- a/src/connections/destinations/catalog/actions-singlestore/index.md +++ b/src/connections/destinations/catalog/actions-singlestore/index.md @@ -27,37 +27,62 @@ This destination is maintained by SingleStore. For any issues with the destinati {% include components/actions-fields.html %} ### Finding your SingleStore connection settings -To find your SingleStore connection settings, head to the [SingleStore Portal](https://portal.singlestore.com){:target="_blank”} and complete the following steps: -1. Select **Deployments**. -2. Choose your Workspace and Database within the list of Deployments -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. +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: + +1. Head to the [SingleStore Portal](https://portal.singlestore.com){:target="_blank"}. +2. Select **Deployments**. +3. Choose your Workspace and Database within the list of Deployments +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. + +**Note:** +- The Data API is enabled by default for all SingleStore Cloud workspaces. +- Segment always uses the Data API (typically on port 443). +- 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. + +For more details, see the [SingleStore Data API documentation](https://docs.singlestore.com/cloud/reference/data-api/){:target="_blank"}. ## Database structure -Segment creates a table called `segment_raw_data` and writes data to your SingleStore database using the following schema: +Segment writes data to your specified table in SingleStore (by default, this is `segment_data`) using the following schema: | Column | Type | Description | | -------- | ------ | ----------- | -| `message` | JSON (utf8_bin) | The entire message received from Segment, in JSON format | -| `timestamp` | datetime | The timestamp of when the event was generated | -| `event` | VARCHAR(255) | The event name (for Track events) | -| `messageId` | VARCHAR(255) | The unique identifier of the event to ensure there is no duplication | -| `type` | VARCHAR(255) | The type of the event (for example, Identify, Track, Page, Group) | - - -### Accessing nested data -To query specific data from the Segment event within SingleStore, you can de-reference the JSON pointer within the message column. For example: +| `messageId` | TEXT | A unique identifier for the event to ensure there is no duplication. | +| `timestamp` | Datetime(6) | The timestamp of when the event was generated | +| `type` | TEXT | The type of the event (e.g., "track", "identify", "page", "screen", "group", "alias"). | +| `event` | TEXT | The name of the event. Only required for "track" events. | +| `name` | TEXT | The name of the page or screen. | +| `properties` | JSON | The properties of the track, page or screen event. | +| `userId` | TEXT | The user ID associated with the event. | +| `anonymousId` | TEXT | The anonymous ID associated with the event. | +| `groupId` | TEXT | The group ID associated with the event. | +| `traits` | JSON | The traits of the user associated with the event. | +| `context` | JSON | The context of the event. Contains user environment information. | + + +### Accessing data +To query specific data from the Segment event within SingleStore, you can select columns directly. For example, to retrieve the `properties` object: ```sql -SELECT message::properties FROM segment_raw_data; +SELECT properties FROM your_table_name; ``` -This query retrieves the properties object from the JSON message, allowing you to work with nested event data. +This query retrieves the `properties` object from the specified table, allowing you to work with event data. ## Troubleshooting +> **Note:** +> 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: +> +> ``` +> Error reading request body: http: request body too large +> ``` +> +> If you encounter this error, reduce the batch size in your Segment destination settings. + + ### Connection Errors If you're unable to connect to the SingleStore database: -* Verify that the Host and Port are correct. +* Verify that the credentials are correct. * Ensure that your SingleStore database is accessible from Segment’s servers. * Check firewall settings and network configurations. @@ -67,7 +92,7 @@ If you encounter authentication errors when Segment attempts to connect: * Ensure that the user has the necessary permissions to write to the database. ### Data Not Appearing in SingleStore -If events are not recorded in the `segment_raw_data` table: +If events are not recorded in the specified table: * Verify that your sources are correctly sending data to Segment. * Check the event types to ensure they are supported. * Review your SingleStore database logs for any errors. @@ -75,7 +100,7 @@ If events are not recorded in the `segment_raw_data` table: ## Frequently Asked Questions ### Can I customize the schema used in SingleStore? -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. +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. ### How does SingleStore handle data types from Segment? @@ -83,4 +108,4 @@ All event data is stored natively as JSON in the message column. This allows for ### Is the data ingestion process real-time? -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. \ No newline at end of file +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. \ No newline at end of file From 31067309e5946f96961c80751e828ab5c53c6d94 Mon Sep 17 00:00:00 2001 From: Parth Sharma Date: Wed, 13 Aug 2025 23:07:36 +0530 Subject: [PATCH 2/3] Access nested data --- .../destinations/catalog/actions-singlestore/index.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/connections/destinations/catalog/actions-singlestore/index.md b/src/connections/destinations/catalog/actions-singlestore/index.md index 612e16eafb..144df0bae7 100644 --- a/src/connections/destinations/catalog/actions-singlestore/index.md +++ b/src/connections/destinations/catalog/actions-singlestore/index.md @@ -59,14 +59,15 @@ Segment writes data to your specified table in SingleStore (by default, this is | `context` | JSON | The context of the event. Contains user environment information. | -### Accessing data -To query specific data from the Segment event within SingleStore, you can select columns directly. For example, to retrieve the `properties` object: +### Accessing nested data +To query nested information from the `traits`, `context`, or `properties` JSON columns, use the `::` operator to access nested properties within the JSON column. For example: +To extract a property1 from the `properties` column: ```sql -SELECT properties FROM your_table_name; +SELECT properties::property1 AS property_1 FROM ; ``` -This query retrieves the `properties` object from the specified table, allowing you to work with event data. +This query allows you to extract specific nested properties from the JSON column for analysis. ## Troubleshooting From a2a15e89268be3bd7e239d33f3aa1454c68cfa75 Mon Sep 17 00:00:00 2001 From: Parth Sharma Date: Wed, 20 Aug 2025 14:22:42 +0530 Subject: [PATCH 3/3] asked changes --- .../catalog/actions-singlestore/index.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/connections/destinations/catalog/actions-singlestore/index.md b/src/connections/destinations/catalog/actions-singlestore/index.md index 144df0bae7..7e68dbab67 100644 --- a/src/connections/destinations/catalog/actions-singlestore/index.md +++ b/src/connections/destinations/catalog/actions-singlestore/index.md @@ -27,19 +27,19 @@ This destination is maintained by SingleStore. For any issues with the destinati {% include components/actions-fields.html %} ### Finding your SingleStore connection settings -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: +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: 1. Head to the [SingleStore Portal](https://portal.singlestore.com){:target="_blank"}. 2. Select **Deployments**. -3. Choose your Workspace and Database within the list of Deployments -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. +3. Choose your **Workspace** and **Database** within the list of deployments. +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. -**Note:** +**Note**: - The Data API is enabled by default for all SingleStore Cloud workspaces. -- Segment always uses the Data API (typically on port 443). -- 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. +- Segment always uses the Data API (typically on port `443`). +- If you use 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. -For more details, see the [SingleStore Data API documentation](https://docs.singlestore.com/cloud/reference/data-api/){:target="_blank"}. +For more information, see the [SingleStore Data API documentation](https://docs.singlestore.com/cloud/reference/data-api/){:target="_blank"}. ## Database structure Segment writes data to your specified table in SingleStore (by default, this is `segment_data`) using the following schema: @@ -48,10 +48,10 @@ Segment writes data to your specified table in SingleStore (by default, this is | -------- | ------ | ----------- | | `messageId` | TEXT | A unique identifier for the event to ensure there is no duplication. | | `timestamp` | Datetime(6) | The timestamp of when the event was generated | -| `type` | TEXT | The type of the event (e.g., "track", "identify", "page", "screen", "group", "alias"). | -| `event` | TEXT | The name of the event. Only required for "track" events. | +| `type` | TEXT | The type of the event (for example, Track, Identify, Page, Screen, Group, or Alias). | +| `event` | TEXT | The name of the event. Only required for Track events. | | `name` | TEXT | The name of the page or screen. | -| `properties` | JSON | The properties of the track, page or screen event. | +| `properties` | JSON | The properties of the Track, Page or Screen event. | | `userId` | TEXT | The user ID associated with the event. | | `anonymousId` | TEXT | The anonymous ID associated with the event. | | `groupId` | TEXT | The group ID associated with the event. | @@ -71,7 +71,7 @@ This query allows you to extract specific nested properties from the JSON column ## Troubleshooting -> **Note:** +> info "Request size limit" > 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: > > ``` @@ -81,7 +81,7 @@ This query allows you to extract specific nested properties from the JSON column > If you encounter this error, reduce the batch size in your Segment destination settings. -### Connection Errors +### Connection errors If you're unable to connect to the SingleStore database: * Verify that the credentials are correct. * Ensure that your SingleStore database is accessible from Segment’s servers. @@ -92,20 +92,20 @@ If you encounter authentication errors when Segment attempts to connect: * Confirm that the Username and Password are correct. * Ensure that the user has the necessary permissions to write to the database. -### Data Not Appearing in SingleStore +### Data not appearing in SingleStore If events are not recorded in the specified table: * Verify that your sources are correctly sending data to Segment. * Check the event types to ensure they are supported. * Review your SingleStore database logs for any errors. -## Frequently Asked Questions +## Frequently asked questions ### Can I customize the schema used in SingleStore? 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. ### How does SingleStore handle data types from Segment? -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. +Event data is stored 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. ### Is the data ingestion process real-time?