-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Luis Moreno <[email protected]>
- Loading branch information
Showing
36 changed files
with
235 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
description: SDF SQL subcommand | ||
title: sdf run sql | ||
sidebar_position: 55 | ||
--- | ||
|
||
# `sdf run sql` | ||
|
||
Use the SQL mode in the CLI, to be able to run SQL queries on SDF states. For a given dataflow, we will have in context for SQL all the [dataframe states], which are essentially the states with an `arrow-row` value. | ||
|
||
For states that are scoped to a window, we will have access to the last flushed state. For states that are not window aware we will have access to the global state. | ||
|
||
In order to enter the SQL mode, type `sql` in the SDF interactive shell created through `sdf run` or `sdf deploy`. In the SQL mode we could perform any sql command supported by the polars engine. | ||
|
||
We can use the `.help` command to see the available options. | ||
|
||
``` | ||
sql >> .help | ||
shape: (3, 2) | ||
┌─────────┬─────────────────────────────────┐ | ||
│ command ┆ description │ | ||
│ --- ┆ --- │ | ||
│ str ┆ str │ | ||
╞═════════╪═════════════════════════════════╡ | ||
│ .exit ┆ Exit this program │ | ||
│ .quit ┆ Exit this program │ | ||
│ .help ┆ Display this help. │ | ||
└─────────┴─────────────────────────────────┘ | ||
``` | ||
|
||
#### Examples: | ||
|
||
##### Run command | ||
|
||
Navigate to the directory with `dataflow.yaml` file, and run the command: | ||
|
||
```bash | ||
$ sdf run | ||
``` | ||
|
||
##### Enter the SQL mode | ||
|
||
Using the sql command: | ||
|
||
```bash | ||
>> sql | ||
SDF SQL version sdf-beta5 | ||
Type .help for help. | ||
``` | ||
|
||
#### Show tables in context | ||
```bash | ||
sql >> show tables | ||
shape: (1, 1) | ||
┌────────────────┐ | ||
│ name │ | ||
│ --- │ | ||
│ str │ | ||
╞════════════════╡ | ||
│ count_per_word │ | ||
└────────────────┘ | ||
``` | ||
|
||
#### Perform a query | ||
|
||
```bash | ||
sql >> select * from count_per_word; | ||
shape: (0, 2) | ||
┌──────┬─────────────┐ | ||
│ _key ┆ occurrences │ | ||
│ --- ┆ --- │ | ||
│ str ┆ u32 │ | ||
╞══════╪═════════════╡ | ||
│ abc │ 10 | | ||
└──────┴─────────────┘ | ||
``` | ||
#### Exit the SQL mode | ||
```bash | ||
sql >> .exit | ||
``` | ||
[dataframe states]: ../concepts/sql.mdx#dataframe-states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
description: SDF Test Command | ||
sidebar_position: 50 | ||
sidebar_position: 98 | ||
--- | ||
|
||
# `sdf test` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ For upgrading cloud workers, please contact [InfinyOn support](#infinyon-support | |
|
||
### CLI changes | ||
|
||
- `sdf run` not longer accepts `--dev`. Develoment mode is now the default for `sdf run`. If you want to run in non-development mode use `--prod`. | ||
- `sdf run` not longer accepts `--dev`. Development mode is now the default for `sdf run`. If you want to run in non-development mode use `--prod`. | ||
|
||
### Improvements | ||
|
||
|
@@ -46,5 +46,5 @@ For upgrading cloud workers, please contact [InfinyOn support](#infinyon-support | |
For any questions or issues, please contact InfinyOn support at [email protected] or https://discordapp.com/invite/bBG2dTz | ||
|
||
[sql mode]: cli/run.mdx#sql-mode | ||
[sql function]: concepts/state-dataframe.mdx#sql-function | ||
[dataframe states]: concepts/state-dataframe.mdx | ||
[sql function]: concepts/sql.mdx#sql-function | ||
[dataframe states]: concepts/sql.mdx#dataframe-states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.