-
Notifications
You must be signed in to change notification settings - Fork 51
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
Data structures via the cli supporting docs #1017
Draft
jamessnowplow
wants to merge
11
commits into
main
Choose a base branch
from
snowplow-cli-data-structures
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7db49f1
Data structures via the cli supporting docs
jamessnowplow 47802ce
snowplow-cli data structures recipe, with actions
jamessnowplow 647b37f
Add DS locking UI in Data Structure
igneel64 aee2ec7
Merge remote-tracking branch 'origin/feature/ds-locking-ui' into snow…
jamessnowplow 0c77ddb
Data structures management, external locking info
jamessnowplow a0f3bb8
Data structures management, be explicit about repositories
jamessnowplow 755867a
Data structures snowplow-cli, workflow->actions + secrets out
jamessnowplow f3cb586
Data structures snowplow-cli, workflow->actions + secrets out, amends
jamessnowplow c34fd7f
data structure cli, s/amd/arm/
jamessnowplow d9aeb6a
snowplow-cli data structures amends and action
jamessnowplow 1c346b5
snowplow-cli data structures amends, path
jamessnowplow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: "Managing Data Structures in git" | ||
description: "Learn how to utilize snowplow-cli and github actions to manage authoring and publishing for your data structures" | ||
sidebar_position: 41 | ||
--- |
2 changes: 1 addition & 1 deletion
2
docs/understanding-tracking-design/managing-your-data-structures/api/index.md
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
Binary file added
BIN
+18.6 KB
...nderstanding-tracking-design/managing-your-data-structures/cli/images/orgID.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions
124
docs/understanding-tracking-design/managing-your-data-structures/cli/index.md
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,124 @@ | ||
--- | ||
title: "Managing data structures via the CLI" | ||
description: "Use the 'snowplow-cli data-structures' command to manage your data structures." | ||
sidebar_label: "Using the CLI" | ||
sidebar_position: 2 | ||
sidebar_custom_props: | ||
offerings: | ||
- bdp | ||
--- | ||
|
||
```mdx-code-block | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
``` | ||
|
||
## Getting started | ||
|
||
The `data-structures` subcommand of [Snowplow CLI](https://github.com/snowplow-product/snowplow-cli) provides a collection of functionality to ease the integration of custom development and publishing workflows. | ||
|
||
### Snowplow CLI Prerequisites | ||
|
||
#### Download | ||
cksnp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Releases can be found on github https://github.com/snowplow-product/snowplow-cli/releases. | ||
|
||
For systems with `curl` available the following commands should get you started with the latest version. Take care to replace `darwin_amd64` with the correct architecture for your system. | ||
|
||
```bash | ||
curl -L -o snowplow-cli https://github.com/snowplow-product/snowplow-cli/releases/latest/download/snowplow-cli_darwin_amd64 | ||
chmod u+x snowplow-cli | ||
``` | ||
|
||
#### Configure | ||
cksnp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
You will need three values. | ||
|
||
API Key Id and API Key Secret are generated from the [credentials section](https://console.snowplowanalytics.com/credentials) in BDP Console. | ||
|
||
Organization Id can be retrieved from the URL immediately following the .com when visiting BDP console: | ||
|
||
![](images/orgID.png) | ||
|
||
Snowplow CLI can take its configuration from a variety of sources. More details are available from `snowplow-cli data-structures --help`. Variations on these three examples should serve most cases. | ||
|
||
<Tabs groupId="config"> | ||
<TabItem value="env" label="env variables" default> | ||
|
||
```bash | ||
SNOWPLOW_CONSOLE_API_KEY_ID=********-****-****-****-************ | ||
SNOWPLOW_CONSOLE_API_KEY_SECRET=********-****-****-****-************ | ||
SNOWPLOW_CONSOLE_ORG_ID=********-****-****-****-************ | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="defaultconfig" label="$HOME/.config/snowplow/snowplow.yml" > | ||
|
||
```yaml | ||
console: | ||
api-key-id: ********-****-****-****-************ | ||
api-key-secret: ********-****-****-****-************ | ||
org-id: ********-****-****-****-************ | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="args" label="inline arguments" > | ||
|
||
```bash | ||
snowplow-cli data-structures --api-key-id ********-****-****-****-************ --api-key-secret ********-****-****-****-************ --org-id ********-****-****-****-************ | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
|
||
## Available commands | ||
|
||
### Creating data structures | ||
|
||
```bash | ||
snowplow-cli ds generate login_click ./folder-name | ||
|
||
``` | ||
|
||
Will create a minimal data structure template in a new file `./folder-name/login_click.yaml`. Note that you will need to add a vendor name to the template before it will pass validation. Alternatively supply a vendor at creation time with the `--vendor com.acme` flag. | ||
|
||
|
||
### Downloading data structures | ||
|
||
```bash | ||
snowplow-cli ds download | ||
``` | ||
|
||
This command will retrieve all organization data structures. By default it will create a folder named `data-structures` in the current working directory to put them in. It uses a combination of vendor and name to further break things down. | ||
|
||
Given a data structure with `vendor: com.acme` and `name: link_click` and assuming the default format of yaml the resulting folder structure will be `./data-structures/com.acme/link_click.yaml`. | ||
|
||
|
||
### Validating data structures | ||
|
||
```bash | ||
snowplow-cli ds validate ./folder-name | ||
``` | ||
|
||
This command will find all files under `./folder-name` (if omitted then `./data-structures`) and attempt to validate them using BDP console. It will assert the following | ||
|
||
1. Is each file a valid format (yaml/json) with expected fields | ||
2. Does the schema in the file conform to [snowplow expectations](/docs/understanding-your-pipeline/schemas/#the-anatomy-of-a-schema) | ||
3. Given the organization's [loading configuration](http://localhost:3000/docs/storing-querying/loading-process/) will any schema version number choices have a potentially negative effect on data loading | ||
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. Probably link needs host update |
||
|
||
If any validations fail the command will report the problems to stdout and exit with status code 1. | ||
|
||
|
||
### Deploying data structures | ||
|
||
```bash | ||
snowplow-cli ds deploy dev ./folder-name | ||
``` | ||
|
||
This command will find all files under `./folder-name` (if omitted then `./data-structures`) and attempt to publish them to BDP console in the environment provided (`dev` or `prod`). | ||
|
||
Publishing to `dev` will also cause data structures to be validated with the `validate` command before upload. Publishing to `prod` will not validate but requires all data structures referenced to be present on `dev`. | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should cloud be included as well?
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.
as far as i can tell this is just how the docs differentiate between BDP and Community. There are no other options.
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.
Maybe I'm mixing something up, or the docs were changed since the last time I've done anything there