Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ items:
- url: /cli/troubleshooting/
title: Troubleshooting

- url: /cli/keboola-as-code/
title: Keboola as Code (legacy)

- url: /workspace/
title: Workspaces
items:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/content/docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kbagent is in beta. Commands and output formats may still change.
:::

:::note
kbagent is a different tool from the legacy **Keboola as Code** CLI (`kbc`) documented on [developers.keboola.com/cli](https://developers.keboola.com/cli/). That tool is still supported for now; new command-line work should use kbagent.
kbagent is a different tool from the legacy **Keboola as Code** CLI (`kbc`) documented under [Keboola as Code CLI](/cli/keboola-as-code/). That tool is still supported for now; new command-line work should use kbagent.
<!-- TODO(human-review, Jordan): confirm the legacy Keboola-as-Code CLI deprecation timeline and where to state it. -->
:::

Expand Down
16 changes: 16 additions & 0 deletions src/content/docs/cli/keboola-as-code/commands/ci/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: CI Command
slug: 'cli/keboola-as-code/commands/ci'
pagefind: false
---


Commands to manage the CI/CD pipeline.

```
kbc ci [command]
```

| Command | Description |
| --- | --- |
| [kbc ci workflows](/cli/keboola-as-code/commands/ci/workflows/) | Generate workflows for [GitHub Actions integration](/cli/keboola-as-code/github-integration/). |
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Workflows
slug: 'cli/keboola-as-code/commands/ci/workflows'
pagefind: false
---


**Generate workflows for [GitHub Actions integration](/cli/keboola-as-code/github-integration/).**

```
kbc ci workflows [flags]
```

You will be prompted to choose which workflows you want to generate:
- `validate` - validates all branches on change
- `push` - pushes each change in the main branch to the project
- `pull` - pulls the main branch from the project every five minutes

## Options

`--ci-main-branch <string>`
: Name of the main branch for push/pull workflows (default "main")

`--ci-pull <bool>`
: Create a workflow to sync the main branch from the project every five minutes (default true)

`--ci-push <bool>`
: Create a workflow to push changes in the main branch to the project (default true)

`--ci-validate <bool>`
: Create a workflow to validate all branches on change to a GitHub branch (default true)

[Global Options](/cli/keboola-as-code/commands/#global-options)

## Example

```
➜ kbc workflows

Please confirm the GitHub Actions you want to generate.

? Generate "validate" workflow?
All GitHub branches will be validated on change. Yes

? Generate "push" workflow?
Each change in the main GitHub branch will be pushed to the project. Yes

? Generate "pull" workflow?
The main GitHub branch will be synchronized every five minutes.
If a change is found, a new commit is created and pushed. Yes

? Please select the main GitHub branch name: main

Generating CI workflows ...
Created file ".github/actions/install/action.yml".
Created file ".github/workflows/validate.yml".
Created file ".github/workflows/push.yml".
Created file ".github/workflows/pull.yml".

CI workflows have been generated.
Feel free to modify them.

Please set the secret KBC_STORAGE_API_TOKEN in the GitHub settings.
See: https://docs.github.com/en/actions/reference/encrypted-secrets
```

## Next Steps

- [All Commands](/cli/keboola-as-code/commands/)
- [GitHub Integration](/cli/keboola-as-code/github-integration/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Generate Env Command
slug: 'cli/keboola-as-code/commands/dbt/generate/env'
pagefind: false
---


**Generates sources in the dbt project directory.**

```
kbc dbt generate sources [flags]
```

The command must be run in a directory with a dbt project (i.e., containing `dbt_project.yml`) or its subdirectory.

The command outputs commands to create environment variables from a selected existing Snowflake workspace.

See the [introduction to dbt support](/cli/keboola-as-code/dbt/) for more information.

## Options

`-H, --storage-api-host <string>`
: Storage API host, e.g., "connection.keboola.com"

`-T, --target-name <string>`
: Target name of the profile

`-W, --workspace-id <string>`
: ID of the workspace to use

[Global Options](/cli/keboola-as-code/commands/#global-options)

## Examples

```
➜ kbc dbt generate env

Please enter the Keboola Storage API host, e.g., "connection.keboola.com".
? API host: connection.north-europe.azure.keboola.com

Please enter the Keboola Storage API token. The value will be hidden.
? API token: **************************************************

Please enter the target name.
Allowed characters: a-z, A-Z, 0-9, "_".
? Target Name: target1

? Workspace: dbt_workspace (12345678)

Commands to set the environment for the dbt target:
export DBT_KBC_TARGET1_TYPE=snowflake
export DBT_KBC_TARGET1_SCHEMA=WORKSPACE_123456
export DBT_KBC_TARGET1_WAREHOUSE=KEBOOLA_PROD_SMALL
export DBT_KBC_TARGET1_DATABASE=KEBOOLA_1234
export DBT_KBC_TARGET1_ACCOUNT=keboola.west-europe.azure
export DBT_KBC_TARGET1_USER=KEBOOLA_WORKSPACE_123456
export DBT_KBC_TARGET1_PASSWORD=abcd123456
```

## Next Steps

- [dbt generate](/cli/keboola-as-code/commands/dbt/generate/)
- [Introduction to dbt support](/cli/keboola-as-code/dbt/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Generate Command
slug: 'cli/keboola-as-code/commands/dbt/generate'
pagefind: false
---


**Work with dbt inside your repository.**

The commands must be run in a directory with a dbt project (i.e., containing `dbt_project.yml`) or its subdirectory.

```
kbc dbt generate [command]
```

| Command | Description |
| --- | --- |
| [kbc dbt generate profile](/cli/keboola-as-code/commands/dbt/generate/profile/) | Generate profiles for use with dbt. |
| [kbc dbt generate sources](/cli/keboola-as-code/commands/dbt/generate/sources/) | Generate sources for use with dbt. |
| [kbc dbt generate env](/cli/keboola-as-code/commands/dbt/generate/env/) | Generate environment variables for use with dbt. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Generate Profile Command
slug: 'cli/keboola-as-code/commands/dbt/generate/profile'
pagefind: false
---


**Generates a profile file in the dbt project directory.**

```
kbc dbt generate profile [flags]
```

The command must be run in a directory with a dbt project (i.e., containing `dbt_project.yml`) or its subdirectory.

The command creates a `profiles.yml` file if it does not exist yet and prepares outputs for the selected target.

See the [introduction to dbt support](/cli/keboola-as-code/dbt/) for more information.

## Options

`-T, --target-name <string>`
: Target name of the profile

[Global Options](/cli/keboola-as-code/commands/#global-options)

## Examples

```
➜ kbc dbt generate profile -T target1

Profile stored in "profiles.yml".
```

The generated `profiles.yml`:

```yaml
TestProject:
target: target1
outputs:
target1:
account: '{{ env_var("DBT_KBC_TARGET1_ACCOUNT") }}'
database: '{{ env_var("DBT_KBC_TARGET1_DATABASE") }}'
password: '{{ env_var("DBT_KBC_TARGET1_PASSWORD") }}'
schema: '{{ env_var("DBT_KBC_TARGET1_SCHEMA") }}'
type: '{{ env_var("DBT_KBC_TARGET1_TYPE") }}'
user: '{{ env_var("DBT_KBC_TARGET1_USER") }}'
warehouse: '{{ env_var("DBT_KBC_TARGET1_WAREHOUSE") }}'
send_anonymous_usage_stats: false
```

## Next Steps

- [dbt generate](/cli/keboola-as-code/commands/dbt/generate/)
- [Introduction to dbt support](/cli/keboola-as-code/dbt/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Generate Sources Command
slug: 'cli/keboola-as-code/commands/dbt/generate/sources'
pagefind: false
---


**Generates sources in the dbt project directory.**

```
kbc dbt generate sources [flags]
```

The command must be run in a directory with a dbt project (i.e., containing `dbt_project.yml`) or its subdirectory.

The command creates a file for each Storage bucket in the `models/_sources` directory containing a dbt source for every table in the bucket.

See the [introduction to dbt support](/cli/keboola-as-code/dbt/) for more information.

## Options

`-H, --storage-api-host <string>`
: Storage API host, e.g., "connection.keboola.com"

`-T, --target-name <string>`
: Target name of the profile

[Global Options](/cli/keboola-as-code/commands/#global-options)

## Examples

```
➜ kbc dbt generate sources

Please enter the Keboola Storage API host, e.g., "connection.keboola.com".
? API host: connection.north-europe.azure.keboola.com

Please enter the Keboola Storage API token. The value will be hidden.
? API token: **************************************************

Please enter the target name.
Allowed characters: a-z, A-Z, 0-9, "_".
? Target Name: target1

Sources stored in the "models/_sources" directory.
```

A generated source file `models/_sources/in.c-test.yml`:

```yaml
version: 2
sources:
- name: in.c-test
freshness:
warn_after:
count: 1
period: day
database: '{{ env_var("DBT_KBC_TARGET1_DATABASE") }}'
schema: in.c-test
loaded_at_field: '"_timestamp"'
tables:
- name: products
quoting:
database: true
schema: true
identifier: true
columns: []
```

## Next Steps

- [dbt generate](/cli/keboola-as-code/commands/dbt/generate/)
- [Introduction to dbt support](/cli/keboola-as-code/dbt/)
24 changes: 24 additions & 0 deletions src/content/docs/cli/keboola-as-code/commands/dbt/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: dbt Command
slug: 'cli/keboola-as-code/commands/dbt'
pagefind: false
---


**Work with dbt inside your repository.**

The commands must be run in a directory with a dbt project (i.e. containing `dbt_project.yml`) or its subdirectory.

See the [introduction to dbt support](/cli/keboola-as-code/dbt/) for more information.

```
kbc dbt [command]
```

| Command | Description |
| --- | --- |
| [kbc dbt init](/cli/keboola-as-code/commands/dbt/init/) | Initialize profiles, sources, and environment variables for use with dbt. |
| [kbc dbt generate](/cli/keboola-as-code/commands/dbt/generate/) | Generate profiles, sources, or environment variables for use with dbt. |
| [kbc dbt generate profile](/cli/keboola-as-code/commands/dbt/generate/profile/) | Generate profiles for use with dbt. |
| [kbc dbt generate sources](/cli/keboola-as-code/commands/dbt/generate/sources/) | Generate sources for use with dbt. |
| [kbc dbt generate env](/cli/keboola-as-code/commands/dbt/generate/env/) | Generate environment variables for use with dbt. |
Loading
Loading