-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Consolidate DDSQL references #28821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate DDSQL references #28821
Changes from 16 commits
de5506a
0d154ee
b4605ee
a2cd50b
bfcbb53
437c77d
4a9646f
a30d753
f92290e
d697648
4a51c13
c793566
629151a
4336f6a
2d78849
8c2611a
aa153ad
077968d
00fa144
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
@@ -219,23 +234,23 @@ SELECT | |
### `TRIM` | ||
{{< code-block lang="sql" >}} | ||
SELECT | ||
TRIM(name) AS trimmed_name | ||
trim(name) AS trimmed_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 >}} | ||
|
@@ -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 >}} | ||
|
@@ -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` | ||
|
@@ -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 >}} | ||
|
@@ -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 >}} | ||
|
@@ -356,7 +371,7 @@ SELECT | |
FROM | ||
emails | ||
WHERE | ||
REGEXP_LIKE(email_address, '@example\.com$') | ||
regexp_like(email_address, '@example\.com$') | ||
{{< /code-block >}} | ||
|
||
### `CARDINALITY` | ||
|
@@ -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 | ||
|
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 >}} | ||
estherk15 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{{< 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" >}} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!