Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ content/en/code_analysis/ @Datadog/static-analysis @Data
content/en/quality_gates/ @Datadog/ci-app-backend @Datadog/documentation

# DDSQL Editor References
content/en/ddsql_editor/reference/*.md @Datadog/xpq @Datadog/documentation
content/en/ddsql_reference/*.md @Datadog/xpq @Datadog/documentation

# Data Streams Monitoring
content/en/data_streams/*.md @Datadog/data-streams-monitoring @Datadog/documentation
Expand Down
52 changes: 9 additions & 43 deletions config/_default/menus/main.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ menu:
pre: cloudcraft
identifier: cloudcraft
parent: essentials_heading
weight: 270000
weight: 130000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old 270000 value was intentional to put Cloudcraft at the bottom of the menu. I probably would have left Cloudcraft at 270000. DDSQL Reference could maybe even be above CoScreen and CoTerm, although then you have to make even more changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Cloudcraft context, moved DDSQL Reference up!

- name: Getting Started
url: cloudcraft/getting-started/
identifier: cloudcraft_getting_started
Expand Down Expand Up @@ -1331,6 +1331,12 @@ menu:
identifier: cloudcraft_api_users_info
parent: cloudcraft_api_users
weight: 1
- name: DDSQL Reference
url: ddsql_reference/
pre: ddsql
identifier: ddsql_reference
parent: essentials_heading
weight: 140000
- name: Watchdog
url: watchdog/
identifier: watchdog_top_level
Expand Down Expand Up @@ -1550,41 +1556,6 @@ menu:
parent: ddsql_editor
identifier: ddsql_editor_getting_started
weight: 1
- name: Statements
url: ddsql_editor/reference/statements
parent: ddsql_editor
identifier: ddsql_editor_statements
weight: 2
- name: Expressions and Operators
url: ddsql_editor/reference/expressions_and_operators
parent: ddsql_editor
identifier: ddsql_editor_expressions_and_operators
weight: 3
- name: Data Types
url: ddsql_editor/reference/data_types
parent: ddsql_editor
identifier: ddsql_editor_data_types
weight: 4
- name: Functions
url: ddsql_editor/reference/functions
parent: ddsql_editor
identifier: ddsql_editor_functions
weight: 5
- name: Querying Tags
url: ddsql_editor/reference/tags
parent: ddsql_editor
identifier: ddsql_editor_tags
weight: 6
- name: Querying Reference Tables
url: ddsql_editor/reference_tables
parent: ddsql_editor
identifier: ddsql_editor_reference_tables
weight: 7
- name: Guides
url: ddsql_editor/guide
parent: ddsql_editor
identifier: ddsql_editor_guide
weight: 10
- name: Reference Tables
url: reference_tables/
pre: inventories
Expand Down Expand Up @@ -5943,21 +5914,16 @@ menu:
parent: log_management
identifier: logs_workspaces
weight: 6
- name: SQL Reference
url: logs/workspaces/sql_reference/
parent: logs_workspaces
identifier: logs_workspaces_sql_reference
weight: 601
- name: Use Cases
url: logs/workspaces/use_cases/
parent: logs_workspaces
identifier: logs_workspaces_use_cases
weight: 602
weight: 601
- name: Time Selection
url: logs/workspaces/time_selection/
parent: logs_workspaces
identifier: logs_workspaces_time_selection
weight: 603
weight: 602
- name: Error Tracking
url: logs/error_tracking/
parent: log_management
Expand Down
2 changes: 2 additions & 0 deletions config/_default/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ code_language_ids:
apache: "Apache HTTP Server"
ibm: "IBM HTTP Server"
gcp-service-extensions: "GCP Service Extensions"
ddsql_preview: "DDSQL (Preview)"
ddsql_default: "DDSQL"
branch: ""

signupclass: sign-up-trigger
Expand Down
21 changes: 8 additions & 13 deletions content/en/ddsql_editor/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
title: DDSQL Editor
aliases:
- /dashboards/ddsql_editor/
- /ddsql_editor/reference/
further_reading:
- link: "/ddsql_editor/reference"
tag: "Documentation"
text: "References for DDSQL Queries"
- link: "/ddsql_editor/guide/ddsql_use_cases"
tag: "Guide"
text: "Common queries and use cases"
- link: "/ddsql_reference/ddsql_preview"
tag: "Documentation"
text: "DDSQL Reference (Preview)"
---


Expand All @@ -33,21 +32,17 @@ Type your question into the search box, and Datadog builds the SQL query for you

DDSQL is a query language for Datadog data. It implements several standard SQL operations, such as `SELECT`, and allows queries against unstructured data, such as [tags][2]. Get exactly the data you want by writing your own `SELECT` statement. Query tags as if they are standard table columns.

<div class="alert alert-warning">
There are two different <strong>variants</strong> of DDSQL. See the syntax documented in <a href="/ddsql_reference/">DDSQL Reference</a>.
</div>

{{< code-block lang="sql" >}}
SELECT instance_type, count(instance_type)
FROM aws_ec2_instance
WHERE env = 'staging' -- env is a tag, not a column
GROUP BY instance_type
{{< /code-block >}}

{{< whatsnext desc="For more information on DDSQL queries, see the DDSQL References:" >}}
{{< nextlink href="ddsql_editor/reference/functions" >}}Functions{{< /nextlink >}}
{{< nextlink href="ddsql_editor/reference/data_types" >}}Data Types{{< /nextlink >}}
{{< nextlink href="ddsql_editor/reference/expressions_and_operators" >}}Expressions and Operators{{< /nextlink >}}
{{< nextlink href="ddsql_editor/reference/statements" >}}Statements{{< /nextlink >}}
{{< nextlink href="ddsql_editor/reference/tags" >}}Tags{{< /nextlink >}}
{{< /whatsnext >}}

### Explore your infrastructure data

View and filter the list of tables and fields in the schema side panel:
Expand Down Expand Up @@ -77,7 +72,7 @@ To access the DDSQL Editor app, users need the `ddsql_editor_read` permission. T
{{< partial name="whats-next/whats-next.html" >}}

[1]: https://app.datadoghq.com/ddsql/editor
[2]: /dashboards/ddsql_editor/reference/tags
[2]: /ddsql_reference/ddsql_preview/tags
[3]: /account_management/rbac/
[4]: /bits_ai
[5]: /help/
2 changes: 1 addition & 1 deletion content/en/ddsql_editor/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ If you forget to save a useful query before navigating away from it, you can sti

[1]: https://app.datadoghq.com/ddsql/editor
[2]: /ddsql_editor/#use-sql-syntax-ddsql
[3]: /ddsql_editor/reference/tags
[3]: /ddsql_reference/ddsql_preview/tags
14 changes: 0 additions & 14 deletions content/en/ddsql_editor/guide/_index.md

This file was deleted.

23 changes: 23 additions & 0 deletions content/en/ddsql_reference/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: DDSQL Reference
type: multi-code-lang
further_reading:
- link: "/ddsql_editor"
tag: "Documentation"
text: "Learn more about the DDSQL Editor"
---

## Supported DDSQL Syntax

DDSQL is a query language for Datadog data. It implements several standard SQL operations, such as `SELECT`, and allows queries against unstructured data, such as [tags][1]. You can perform actions like getting exactly the data you want by writing your own `SELECT` statement, or querying tags as if they are standard table columns.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice description


{{< whatsnext desc="Syntax references:" >}}
{{< nextlink href="/ddsql_reference/ddsql_default" >}}DDSQL{{< /nextlink >}}
{{< nextlink href="/ddsql_reference/ddsql_preview" >}}DDSQL (Preview){{< /nextlink >}}
{{< /whatsnext >}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /ddsql_reference/ddsql_preview/tags
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
---
title: SQL Reference
title: DDSQL
aliases:
- /logs/workspaces/sql_reference
code_lang: ddsql_default
type: multi-code-lang
code_lang_weight: 1
products:
- name: Log Workspaces
url: /logs/workspaces/
icon: logs
further_reading:
- link: "/logs/workspaces/"
tag: "Documentation"
text: "Learn more about Log Workspaces"
---

{{< product-availability >}}

<div class="alert alert-warning">
There are two different <strong>variants</strong> of DDSQL. For the <strong>DDSQL Editor</strong>, see the <a href="/ddsql_reference/ddsql_preview">DDSQL (Preview) documentation</a>.
</div>

## Overview

SQL in [Analysis cells][1] allows you to analyze and manipulate data within Log Workspaces. This documentation covers the SQL support available in Log Workspaces and includes:
SQL in [Analysis cells][1] allows you to analyze and manipulate data. This documentation covers the SQL support available and includes:
- [Syntax compatible with PostgreSQL](#syntax)
- [SQL functions](#functions)
- [Window functions](#window-functions)
Expand Down Expand Up @@ -219,23 +234,23 @@ SELECT
### `TRIM`
{{< code-block lang="sql" >}}
SELECT
TRIM(name) AS trimmed_name
trim(name) AS trimmed_name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Since SQL is not case sensitive, it is find to make this lowercase. However, it is nice to keep them upper case as they are functions/keywords

FROM
users
{{< /code-block >}}

### `REPLACE`
{{< code-block lang="sql" >}}
SELECT
REPLACE(description, 'old', 'new') AS updated_description
replace(description, 'old', 'new') AS updated_description
FROM
products
{{< /code-block >}}

### `SUBSTRING`
{{< code-block lang="sql" >}}
SELECT
SUBSTRING(title, 1, 10) AS short_title
substring(title, 1, 10) AS short_title
FROM
books
{{< /code-block >}}
Expand Down Expand Up @@ -272,7 +287,7 @@ Supported extraction units:

{{< code-block lang="sql" >}}
SELECT
EXTRACT(year FROM purchase_date) AS purchase_year
extract(year FROM purchase_date) AS purchase_year
FROM
sales
{{< /code-block >}}
Expand All @@ -299,7 +314,7 @@ Supported patterns for date/time formatting:

{{< code-block lang="sql" >}}
SELECT
TO_TIMESTAMP('25/12/2025 04:23 pm', 'DD/MM/YYYY HH:MI am') AS ts
to_timestamp('25/12/2025 04:23 pm', 'DD/MM/YYYY HH:MI am') AS ts
{{< /code-block >}}

### `TO_CHAR`
Expand All @@ -324,7 +339,7 @@ Supported patterns for date/time formatting:

{{< code-block lang="sql" >}}
SELECT
TO_CHAR(order_date, 'MM-DD-YYYY') AS formatted_date
to_char(order_date, 'MM-DD-YYYY') AS formatted_date
FROM
orders
{{< /code-block >}}
Expand All @@ -344,7 +359,7 @@ Supported truncations:

{{< code-block lang="sql" >}}
SELECT
DATE_TRUNC('month', event_time) AS month_start
date_trunc('month', event_time) AS month_start
FROM
events
{{< /code-block >}}
Expand All @@ -356,7 +371,7 @@ SELECT
FROM
emails
WHERE
REGEXP_LIKE(email_address, '@example\.com$')
regexp_like(email_address, '@example\.com$')
{{< /code-block >}}

### `CARDINALITY`
Expand Down Expand Up @@ -408,19 +423,19 @@ FROM

## Window functions

This table provides an overview of the supprted window functions. For comprehensive details and examples, see to the [PostgreSQL documentation][2].

| Function | Return Type | Description |
|-------------------------------|-------------------|------------------------------------------------------------------------|
| `over` | N/A | Defines a window for a set of rows for other window functions to operate on. |
| `partition by` | N/A | Divides the result set into partitions, specifically for applying window functions. |
| `rank()` | integer | Assigns a rank to each row within a partition, with gaps for ties. |
| `row_number()` | integer | Assigns a unique sequential number to each row within a partition. |
| `lead(column n)` | typeof column | Returns the value from the next row in the partition. |
| `lag(column n)` | typeof column | Returns the value from the previous row in the partition. |
| `first_value(column n)` | typeof column | Returns the first value in an ordered set of values. |
| `last_value(column n)` | typeof column | Returns the last value in an ordered set of values. |
| `nth_value(column n, offset)` | typeof column | Returns the value at the specified offset in an ordered set of values. |
This table provides an overview of the supprted window functions. For comprehensive details and examples, see the [PostgreSQL documentation][2].

| Function | Return Type | Description |
|-------------------------|-------------------|------------------------------------------------------------------------|
| `OVER` | N/A | Defines a window for a set of rows for other window functions to operate on. |
| `PARTITION BY` | N/A | Divides the result set into partitions, specifically for applying window functions. |
| `RANK()` | integer | Assigns a rank to each row within a partition, with gaps for ties. |
| `ROW_NUMBER()` | integer | Assigns a unique sequential number to each row within a partition. |
| `LEAD(column n)` | typeof column | Returns the value from the next row in the partition. |
| `LAG(column n)` | typeof column | Returns the value from the previous row in the partition. |
| `FIRST_VALUE(column n)` | typeof column | Returns the first value in an ordered set of values. |
| `LAST_VALUE(column n)` | typeof column | Returns the last value in an ordered set of values. |
| `NTH_VALUE(column n, offset)`| typeof column | Returns the value at the specified offset in an ordered set of values. |


## Further reading
Expand Down
37 changes: 37 additions & 0 deletions content/en/ddsql_reference/ddsql_preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: DDSQL (Preview)
code_lang: ddsql_preview
type: multi-code-lang
code_lang_weight: 2
products:
- name: DDSQL Editor
url: /ddsql_editor/
icon: ddsql
further_reading:
- link: "/ddsql_editor/"
tag: "Documentation"
text: "Learn more about the DDSQL Editor"
---

{{< product-availability >}}

{{< callout url="https://datadoghq.com/private-beta/ddsql-editor">}}
DDSQL Editor is in Preview.
{{< /callout >}}

{{< whatsnext desc="DDSQL (Preview) References:" >}}
{{< nextlink href="ddsql_reference/ddsql_preview/functions" >}}Functions{{< /nextlink >}}
{{< nextlink href="ddsql_reference/ddsql_preview/data_types" >}}Data Types{{< /nextlink >}}
{{< nextlink href="ddsql_reference/ddsql_preview/expressions_and_operators" >}}Expressions and Operators{{< /nextlink >}}
{{< nextlink href="ddsql_reference/ddsql_preview/statements" >}}Statements{{< /nextlink >}}
{{< /whatsnext >}}

{{< whatsnext desc="Guides for using DDSQL (Preview) Queries:" >}}
{{< nextlink href="ddsql_reference/ddsql_preview/ddsql_use_cases" >}}Common DDSQL queries and use cases{{< /nextlink >}}
{{< nextlink href="ddsql_reference/ddsql_preview/reference_tables" >}}Reference Tables in DDSQL{{< /nextlink >}}
{{< nextlink href="ddsql_reference/ddsql_preview/tags" >}}Querying Tags in DDSQL{{< /nextlink >}}
{{< /whatsnext >}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
title: DDSQL Data Types
title: DDSQL Editor Data Types (Preview)
aliases:
- /dashboards/ddsql_editor/reference/data_types/
- /ddsql_editor/reference/data_types/
---

{{< callout url="https://datadoghq.com/private-beta/ddsql-editor">}}
DDSQL is in Preview.
{{< /callout >}}

## Data types

DDSQL implements a simplified version of the SQL type system that is mostly descended from PostgreSQL.
Expand Down
Loading
Loading