strata-cli 0.1.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/CLAUDE.md +65 -0
- data/LICENSE +21 -0
- data/README.md +465 -0
- data/Rakefile +10 -0
- data/exe/strata +6 -0
- data/lib/strata/cli/ai/client.rb +63 -0
- data/lib/strata/cli/ai/configuration.rb +48 -0
- data/lib/strata/cli/ai/services/table_generator.rb +282 -0
- data/lib/strata/cli/api/client.rb +170 -0
- data/lib/strata/cli/api/connection_error_handler.rb +54 -0
- data/lib/strata/cli/configuration.rb +135 -0
- data/lib/strata/cli/credentials.rb +83 -0
- data/lib/strata/cli/descriptions/create/migration.txt +25 -0
- data/lib/strata/cli/descriptions/create/relation.txt +14 -0
- data/lib/strata/cli/descriptions/create/table.txt +23 -0
- data/lib/strata/cli/descriptions/datasource/add.txt +15 -0
- data/lib/strata/cli/descriptions/datasource/auth.txt +14 -0
- data/lib/strata/cli/descriptions/datasource/exec.txt +7 -0
- data/lib/strata/cli/descriptions/datasource/meta.txt +11 -0
- data/lib/strata/cli/descriptions/datasource/tables.txt +12 -0
- data/lib/strata/cli/descriptions/datasource/test.txt +8 -0
- data/lib/strata/cli/descriptions/deploy/deploy.txt +24 -0
- data/lib/strata/cli/descriptions/deploy/status.txt +9 -0
- data/lib/strata/cli/descriptions/init.txt +14 -0
- data/lib/strata/cli/generators/datasource.rb +83 -0
- data/lib/strata/cli/generators/group.rb +13 -0
- data/lib/strata/cli/generators/migration.rb +71 -0
- data/lib/strata/cli/generators/project.rb +190 -0
- data/lib/strata/cli/generators/relation.rb +64 -0
- data/lib/strata/cli/generators/table.rb +143 -0
- data/lib/strata/cli/generators/templates/adapters/athena.yml +53 -0
- data/lib/strata/cli/generators/templates/adapters/druid.yml +42 -0
- data/lib/strata/cli/generators/templates/adapters/duckdb.yml +36 -0
- data/lib/strata/cli/generators/templates/adapters/mysql.yml +45 -0
- data/lib/strata/cli/generators/templates/adapters/postgres.yml +48 -0
- data/lib/strata/cli/generators/templates/adapters/snowflake.yml +69 -0
- data/lib/strata/cli/generators/templates/adapters/sqlserver.yml +45 -0
- data/lib/strata/cli/generators/templates/adapters/trino.yml +56 -0
- data/lib/strata/cli/generators/templates/datasources.yml +4 -0
- data/lib/strata/cli/generators/templates/migration.rename.yml +15 -0
- data/lib/strata/cli/generators/templates/migration.swap.yml +13 -0
- data/lib/strata/cli/generators/templates/project.yml +36 -0
- data/lib/strata/cli/generators/templates/rel.domain.yml +43 -0
- data/lib/strata/cli/generators/templates/strata.yml +24 -0
- data/lib/strata/cli/generators/templates/table.table_name.yml +118 -0
- data/lib/strata/cli/generators/templates/test.yml +34 -0
- data/lib/strata/cli/generators/test.rb +48 -0
- data/lib/strata/cli/guard.rb +21 -0
- data/lib/strata/cli/helpers/color_helper.rb +103 -0
- data/lib/strata/cli/helpers/command_context.rb +41 -0
- data/lib/strata/cli/helpers/datasource_helper.rb +62 -0
- data/lib/strata/cli/helpers/description_helper.rb +18 -0
- data/lib/strata/cli/helpers/project_helper.rb +85 -0
- data/lib/strata/cli/helpers/prompts.rb +42 -0
- data/lib/strata/cli/helpers/table_filter.rb +48 -0
- data/lib/strata/cli/main.rb +71 -0
- data/lib/strata/cli/sub_commands/audit.rb +262 -0
- data/lib/strata/cli/sub_commands/create.rb +419 -0
- data/lib/strata/cli/sub_commands/datasource.rb +353 -0
- data/lib/strata/cli/sub_commands/deploy.rb +433 -0
- data/lib/strata/cli/sub_commands/project.rb +38 -0
- data/lib/strata/cli/sub_commands/table.rb +58 -0
- data/lib/strata/cli/terminal.rb +102 -0
- data/lib/strata/cli/ui/autocomplete.rb +93 -0
- data/lib/strata/cli/ui/field_editor.rb +215 -0
- data/lib/strata/cli/utils/archive.rb +137 -0
- data/lib/strata/cli/utils/deployment_monitor.rb +445 -0
- data/lib/strata/cli/utils/git.rb +253 -0
- data/lib/strata/cli/utils/import_manager.rb +190 -0
- data/lib/strata/cli/utils/test_reporter.rb +131 -0
- data/lib/strata/cli/utils/yaml_import_resolver.rb +91 -0
- data/lib/strata/cli/utils.rb +39 -0
- data/lib/strata/cli/version.rb +7 -0
- data/lib/strata/cli.rb +36 -0
- data/sig/strata/cli.rbs +6 -0
- metadata +306 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "group"
|
|
4
|
+
require "yaml"
|
|
5
|
+
require "fileutils"
|
|
6
|
+
|
|
7
|
+
module Strata
|
|
8
|
+
module CLI
|
|
9
|
+
module Generators
|
|
10
|
+
# Generates a relationship definition YAML file from template.
|
|
11
|
+
class Relation < Group
|
|
12
|
+
desc "Generates a relationship definition YAML file from template."
|
|
13
|
+
argument :path, type: :string, desc: "Path for the relationship file (e.g., customer/orders)"
|
|
14
|
+
argument :datasource, type: :string, desc: "Datasource key"
|
|
15
|
+
|
|
16
|
+
def create_relation_file
|
|
17
|
+
output_path = resolve_output_path
|
|
18
|
+
|
|
19
|
+
# Ensure directory exists
|
|
20
|
+
empty_directory File.dirname(output_path)
|
|
21
|
+
|
|
22
|
+
# Load template and update with datasource
|
|
23
|
+
template_content = load_template
|
|
24
|
+
updated_content = update_template(template_content)
|
|
25
|
+
|
|
26
|
+
# Write the updated template
|
|
27
|
+
create_file output_path, updated_content
|
|
28
|
+
|
|
29
|
+
say_status :created, output_path, :green
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def load_template
|
|
35
|
+
template_path = File.join(File.dirname(__FILE__), "templates/rel.domain.yml")
|
|
36
|
+
File.read(template_path)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def update_template(template_content)
|
|
40
|
+
# Replace datasource placeholder
|
|
41
|
+
template_content.gsub("<datasource_name>", datasource)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def resolve_output_path
|
|
45
|
+
# Derive relation name from path: last part after / or path itself if no /
|
|
46
|
+
# Examples:
|
|
47
|
+
# "sales/orders" -> "models/sales/rel.orders.yml"
|
|
48
|
+
# "customer" -> "models/rel.customer.yml"
|
|
49
|
+
path_parts = path.split("/")
|
|
50
|
+
relation_name = path_parts.last.downcase
|
|
51
|
+
filename = "rel.#{relation_name}.yml"
|
|
52
|
+
|
|
53
|
+
if path_parts.length > 1
|
|
54
|
+
subdir = path_parts[0..-2].join("/")
|
|
55
|
+
"models/#{subdir}/#{filename}"
|
|
56
|
+
else
|
|
57
|
+
# No subdirectory: models/rel.customer.yml
|
|
58
|
+
"models/#{filename}"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "group"
|
|
4
|
+
require "yaml"
|
|
5
|
+
|
|
6
|
+
module Strata
|
|
7
|
+
module CLI
|
|
8
|
+
module Generators
|
|
9
|
+
# Generates a semantic table model YAML file from field definitions.
|
|
10
|
+
class Table < Group
|
|
11
|
+
argument :path, type: :string, desc: "Output path (e.g., sales/orders)"
|
|
12
|
+
argument :datasource, type: :string, desc: "Datasource key"
|
|
13
|
+
argument :physical_name, type: :string, desc: "Physical table name"
|
|
14
|
+
argument :fields_data, type: :array, desc: "Field definitions from editor"
|
|
15
|
+
argument :model_context, type: :hash, desc: "Model metadata (description)"
|
|
16
|
+
|
|
17
|
+
class_option :name, type: :string, desc: "Model display name"
|
|
18
|
+
class_option :cost, type: :numeric, default: 10, desc: "Query cost"
|
|
19
|
+
|
|
20
|
+
def create_model_file
|
|
21
|
+
# Build output path: models/<path>/tbl.<table_name>.yml
|
|
22
|
+
# e.g., "sales/customer" -> "models/sales/tbl.customer.yml"
|
|
23
|
+
# Filenames are standardized to lowercase
|
|
24
|
+
path_parts = path.split("/")
|
|
25
|
+
table_name = path_parts.last.downcase
|
|
26
|
+
|
|
27
|
+
if path_parts.length > 1
|
|
28
|
+
# Has subdirectory: models/sales/tbl.customer.yml
|
|
29
|
+
subdir = path_parts[0..-2].join("/")
|
|
30
|
+
output_path = "models/#{subdir}/tbl.#{table_name}.yml"
|
|
31
|
+
else
|
|
32
|
+
# No subdirectory: models/tbl.customer.yml
|
|
33
|
+
output_path = "models/tbl.#{table_name}.yml"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Ensure directory exists
|
|
37
|
+
empty_directory File.dirname(output_path)
|
|
38
|
+
|
|
39
|
+
# Load template and update with user inputs
|
|
40
|
+
template_content = load_template
|
|
41
|
+
updated_content = update_template(template_content)
|
|
42
|
+
|
|
43
|
+
# Write the updated template
|
|
44
|
+
create_file output_path, updated_content
|
|
45
|
+
|
|
46
|
+
say_status :created, output_path, :green
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def load_template
|
|
52
|
+
template_path = File.join(File.dirname(__FILE__), "templates/table.table_name.yml")
|
|
53
|
+
File.read(template_path)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def update_template(template_content)
|
|
57
|
+
# Get values to replace
|
|
58
|
+
table_name = options[:name] || derive_name
|
|
59
|
+
cost_value = options[:cost] || 10
|
|
60
|
+
fields_yaml = format_fields_to_yaml
|
|
61
|
+
|
|
62
|
+
# Replace placeholders
|
|
63
|
+
content = template_content.dup
|
|
64
|
+
content.gsub!("<datasource_name>", datasource)
|
|
65
|
+
content.gsub!("<table_name>", table_name)
|
|
66
|
+
content.gsub!("<physical_table_name>", physical_name)
|
|
67
|
+
content.gsub!(/^cost: \d+/, "cost: #{cost_value}")
|
|
68
|
+
|
|
69
|
+
# Replace the fields section
|
|
70
|
+
# Find the "fields:" line and replace everything from there to the end of file
|
|
71
|
+
fields_section_start = content.index(/^fields:/)
|
|
72
|
+
if fields_section_start
|
|
73
|
+
before_fields = content[0...fields_section_start].rstrip
|
|
74
|
+
# Add description comment if provided
|
|
75
|
+
desc = model_context[:description] || model_context["description"]
|
|
76
|
+
before_fields += "\n# Description: #{desc}\n" if desc && !desc.to_s.empty?
|
|
77
|
+
"#{before_fields}\nfields:\n#{fields_yaml}"
|
|
78
|
+
else
|
|
79
|
+
# If no fields: found, append it
|
|
80
|
+
desc = model_context[:description] || model_context["description"]
|
|
81
|
+
desc_comment = (desc && !desc.to_s.empty?) ? "\n# Description: #{desc}\n" : ""
|
|
82
|
+
"#{content.rstrip}#{desc_comment}\nfields:\n#{fields_yaml}"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def derive_name
|
|
87
|
+
# Extract table name from path (last part, without schema)
|
|
88
|
+
# Examples:
|
|
89
|
+
# "call_center" -> "call_center"
|
|
90
|
+
# "games/event_details" -> "event_details"
|
|
91
|
+
# "contact/dse.call_center_d" -> "call_center_d"
|
|
92
|
+
last_part = path.split("/").last
|
|
93
|
+
# Remove schema prefix if present (e.g., "dse.call_center_d" -> "call_center_d")
|
|
94
|
+
last_part.include?(".") ? last_part.split(".", 2).last : last_part
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def format_fields_to_yaml
|
|
98
|
+
return "\n # No fields defined yet. Add your fields here.\n" if fields_data.empty?
|
|
99
|
+
|
|
100
|
+
fields_array = fields_data.map do |field|
|
|
101
|
+
# Normalize hash keys to symbols for consistent access
|
|
102
|
+
normalized = normalize_field_hash(field)
|
|
103
|
+
|
|
104
|
+
field_hash = {
|
|
105
|
+
"type" => normalized[:schema_type] || "dimension",
|
|
106
|
+
"name" => normalized[:name],
|
|
107
|
+
"description" => normalized[:description],
|
|
108
|
+
"data_type" => normalized[:data_type]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
# Build expression with proper nested format
|
|
112
|
+
expr = normalized[:expression]
|
|
113
|
+
field_hash["expression"] = {
|
|
114
|
+
"lookup" => true,
|
|
115
|
+
"sql" => expr
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
field_hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Convert to YAML, indent properly, and remove the leading "---\n"
|
|
122
|
+
yaml_output = fields_array.to_yaml
|
|
123
|
+
yaml_output = yaml_output.sub(/^---\n/, "")
|
|
124
|
+
|
|
125
|
+
# Indent all lines by 2 spaces (since fields: is at root level)
|
|
126
|
+
# Empty lines should remain empty (not indented)
|
|
127
|
+
yaml_output.split("\n").map do |line|
|
|
128
|
+
line.empty? ? "" : " #{line}"
|
|
129
|
+
end.join("\n")
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def normalize_field_hash(field)
|
|
133
|
+
# Convert string keys to symbol keys for consistent access
|
|
134
|
+
# Handles both {name: "x"} and {"name" => "x"} formats
|
|
135
|
+
field.each_with_object({}) do |(key, value), normalized|
|
|
136
|
+
sym_key = key.is_a?(Symbol) ? key : key.to_sym
|
|
137
|
+
normalized[sym_key] = value
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the cold tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: cold
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: athena
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 600
|
|
20
|
+
|
|
21
|
+
# Required: AWS region where your Athena service is located
|
|
22
|
+
region: us-east-1
|
|
23
|
+
|
|
24
|
+
# Required: S3 location for query results storage
|
|
25
|
+
s3_output_location: s3://your-athena-results-bucket/queries/
|
|
26
|
+
|
|
27
|
+
# Required: Athena database/schema name
|
|
28
|
+
database: default
|
|
29
|
+
|
|
30
|
+
# Optional: Athena catalog name (default: awsdatacatalog)
|
|
31
|
+
catalog: awsdatacatalog
|
|
32
|
+
|
|
33
|
+
# Optional: Athena workgroup name
|
|
34
|
+
# workgroup: primary
|
|
35
|
+
|
|
36
|
+
# AWS Authentication:
|
|
37
|
+
# Option 1: Use IAM role (recommended for EC2/ECS/Lambda)
|
|
38
|
+
# No explicit credentials needed - uses instance profile or task role
|
|
39
|
+
|
|
40
|
+
# Option 2: Explicit credentials (not recommended for production)
|
|
41
|
+
# You can set these here. But to set securely please run:
|
|
42
|
+
# `strata ds auth <%= @ds_key %>`
|
|
43
|
+
# This command will save your credentials to the .strata global or local file.
|
|
44
|
+
# access_key_id: AKIA...
|
|
45
|
+
# secret_access_key:
|
|
46
|
+
|
|
47
|
+
# Option 3: Environment variables
|
|
48
|
+
# Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
|
|
49
|
+
|
|
50
|
+
# Extra connection properties will forward these along when
|
|
51
|
+
# connecting to your Athena service.
|
|
52
|
+
# extra_connection_params:
|
|
53
|
+
# session_token: temporary_token_if_needed
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display namem of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# priortize a datasource when multiple can handle the request.
|
|
10
|
+
tier: hot
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: druid
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Should be http or https
|
|
19
|
+
protocol: http
|
|
20
|
+
port: 7103
|
|
21
|
+
|
|
22
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
23
|
+
query_timeout: 600
|
|
24
|
+
host: product.mydomain.net
|
|
25
|
+
|
|
26
|
+
# You can set username here. But to set password securely please run:
|
|
27
|
+
# `strata ds auth <%= @ds_key %>`
|
|
28
|
+
# This command will save your credentials to the .strata global or local file.
|
|
29
|
+
# username:
|
|
30
|
+
#
|
|
31
|
+
# Extra connection properties will forward these along when
|
|
32
|
+
# connecting to your druid server.
|
|
33
|
+
# extra_connection_params:
|
|
34
|
+
# trustStore: /path/to/trustStore
|
|
35
|
+
|
|
36
|
+
# Extra query params will forward these params when executing a
|
|
37
|
+
# query against your druid servers:
|
|
38
|
+
# extra_query_params:
|
|
39
|
+
# headers:
|
|
40
|
+
# X-DRUID-AUTHOR: ${current_user_name}
|
|
41
|
+
# X-DRUID-COMMENT: STRATA CLI
|
|
42
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: hot
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: duckdb
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 600
|
|
20
|
+
|
|
21
|
+
# Required: Path to the DuckDB database file
|
|
22
|
+
file: /path/to/your/duckdb/database.db
|
|
23
|
+
|
|
24
|
+
# Optional: Schema name (default: main)
|
|
25
|
+
# schema: main
|
|
26
|
+
|
|
27
|
+
# Optional: DuckDB configuration parameters
|
|
28
|
+
# These are passed directly to the DuckDB connection
|
|
29
|
+
# duck_config:
|
|
30
|
+
# access_mode: READ_WRITE
|
|
31
|
+
# memory_limit: 1GB
|
|
32
|
+
# threads: 4
|
|
33
|
+
|
|
34
|
+
# Note: DuckDB is an in-process analytical database
|
|
35
|
+
# No network configuration required (host/port/etc.)
|
|
36
|
+
# File path can be relative or absolute
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the warm tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: warm
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: mysql
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 3600
|
|
20
|
+
|
|
21
|
+
# Required: MySQL server host (use 127.0.0.1 for local Docker instances)
|
|
22
|
+
host: 127.0.0.1
|
|
23
|
+
|
|
24
|
+
# Optional: Port number (default: 3306)
|
|
25
|
+
port: 3306
|
|
26
|
+
|
|
27
|
+
# Required: Database name
|
|
28
|
+
database: mydb
|
|
29
|
+
|
|
30
|
+
# Required: Username for connection
|
|
31
|
+
username: root
|
|
32
|
+
|
|
33
|
+
# Optional: Enable SSL (default: false)
|
|
34
|
+
ssl: false
|
|
35
|
+
|
|
36
|
+
# You can set password here. But to set password securely please run:
|
|
37
|
+
# `strata ds auth <%= @ds_key %>`
|
|
38
|
+
# This command will save your credentials to the .strata global or local file.
|
|
39
|
+
# password:
|
|
40
|
+
|
|
41
|
+
# Extra connection properties will forward these along when
|
|
42
|
+
# connecting to your MySQL server.
|
|
43
|
+
# extra_connection_params:
|
|
44
|
+
# ssl_mode: REQUIRED
|
|
45
|
+
# connect_timeout: 10
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: warm
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: postgres
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 3600
|
|
20
|
+
|
|
21
|
+
# Required: PostgreSQL server host
|
|
22
|
+
host: localhost
|
|
23
|
+
|
|
24
|
+
# Optional: Port number (default: 5432)
|
|
25
|
+
port: 5432
|
|
26
|
+
|
|
27
|
+
# Required: Database name
|
|
28
|
+
database: mydb
|
|
29
|
+
|
|
30
|
+
# Required: Username for connection
|
|
31
|
+
username: postgres
|
|
32
|
+
|
|
33
|
+
# Optional: Schema name (default: public)
|
|
34
|
+
schema: public
|
|
35
|
+
|
|
36
|
+
# Optional: Enable SSL (default: false)
|
|
37
|
+
ssl: false
|
|
38
|
+
|
|
39
|
+
# You can set password here. But to set password securely please run:
|
|
40
|
+
# `strata ds auth <%= @ds_key %>`
|
|
41
|
+
# This command will save your credentials to the .strata global or local file.
|
|
42
|
+
# password:
|
|
43
|
+
|
|
44
|
+
# Extra connection properties will forward these along when
|
|
45
|
+
# connecting to your PostgreSQL server.
|
|
46
|
+
# extra_connection_params:
|
|
47
|
+
# sslmode: require
|
|
48
|
+
# connect_timeout: 10
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: warm
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: snowflake
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 3600
|
|
20
|
+
|
|
21
|
+
# Required: Your Snowflake account identifier (e.g., myorg-myaccount.us-east-1)
|
|
22
|
+
account_identifier: myorg-myaccount
|
|
23
|
+
|
|
24
|
+
# Required: Database name
|
|
25
|
+
database: ANALYTICS_DB
|
|
26
|
+
|
|
27
|
+
# Optional: Warehouse name
|
|
28
|
+
warehouse: COMPUTE_WH
|
|
29
|
+
|
|
30
|
+
# Optional: Schema name
|
|
31
|
+
schema: PUBLIC
|
|
32
|
+
|
|
33
|
+
# Optional: Role name
|
|
34
|
+
role: ACCOUNTADMIN
|
|
35
|
+
|
|
36
|
+
# Required: Authentication mode - one of: pat, kp, oauth
|
|
37
|
+
# pat: personal_access_token
|
|
38
|
+
# kp: key pair (requires username)
|
|
39
|
+
# oauth: OAuth (requires setup on snowflake to enable)
|
|
40
|
+
# Additional required params
|
|
41
|
+
# oauth_client_id: <MYCLIENTID>
|
|
42
|
+
# oauth_cleint_secret: <MYCLIENTSECRET>
|
|
43
|
+
# oauth_redirect_uri: https://localhost:3420/callback
|
|
44
|
+
# oauth_scope: <SCOPE> # optional
|
|
45
|
+
auth_mode: pat
|
|
46
|
+
|
|
47
|
+
# For Personal Access Token (PAT) authentication:
|
|
48
|
+
# You can set personal_access_token here. But to set securely please run:
|
|
49
|
+
# `strata ds auth <%= @ds_key %>`
|
|
50
|
+
# This command will save your credentials to the .strata global or local file.
|
|
51
|
+
# personal_access_token:
|
|
52
|
+
|
|
53
|
+
# For Key Pair (KP) authentication, uncomment and set:
|
|
54
|
+
# username: john_doe
|
|
55
|
+
# private_key: /path/to/private_key.pem
|
|
56
|
+
|
|
57
|
+
# For OAuth authentication, additional setup required.
|
|
58
|
+
# https://docs.snowflake.com/en/user-guide/oauth-custom
|
|
59
|
+
#
|
|
60
|
+
# Securely save tokens in .strata by running:
|
|
61
|
+
# `strata ds auth <%= @ds_key %>`
|
|
62
|
+
#
|
|
63
|
+
# This would only work if your snowflake setup allows modification
|
|
64
|
+
# of the redirect url. Otherwise, you can get access_token and
|
|
65
|
+
# refresh_token by other means. Then add it to .strata like so:
|
|
66
|
+
#
|
|
67
|
+
# access_token: wrwerjwrljwer
|
|
68
|
+
# refresh_token: erwerewrwer
|
|
69
|
+
# expires_at: <%= Time.now %>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: cold
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: sqlserver
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 3600
|
|
20
|
+
|
|
21
|
+
# Required: SQL Server host
|
|
22
|
+
host: localhost
|
|
23
|
+
|
|
24
|
+
# Optional: Port number (default: 1433)
|
|
25
|
+
port: 1433
|
|
26
|
+
|
|
27
|
+
# Required: Database name
|
|
28
|
+
database: mydb
|
|
29
|
+
|
|
30
|
+
# Required: Username for connection
|
|
31
|
+
username: sa
|
|
32
|
+
|
|
33
|
+
# Optional: Flag for Azure SQL Server (default: false)
|
|
34
|
+
azure: false
|
|
35
|
+
|
|
36
|
+
# You can set password here. But to set password securely please run:
|
|
37
|
+
# `strata ds auth <%= @ds_key %>`
|
|
38
|
+
# This command will save your credentials to the .strata global or local file.
|
|
39
|
+
# password:
|
|
40
|
+
|
|
41
|
+
# Extra connection properties will forward these along when
|
|
42
|
+
# connecting to your SQL Server.
|
|
43
|
+
# extra_connection_params:
|
|
44
|
+
# encrypt: true
|
|
45
|
+
# trust_server_certificate: true
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Datasource key should be unique in the Project
|
|
2
|
+
<%= @ds_key %>:
|
|
3
|
+
# This is the display name of this datasource
|
|
4
|
+
name: MYDATASOURCENAME
|
|
5
|
+
# Optional description to provide more information in the UI
|
|
6
|
+
description: This DS is the hot tier of our Product Domain
|
|
7
|
+
|
|
8
|
+
# Required. Should be one of hot, warm, or cold. Helps the Query engine
|
|
9
|
+
# prioritize a datasource when multiple can handle the request.
|
|
10
|
+
tier: cold
|
|
11
|
+
|
|
12
|
+
# A valid supported adapter
|
|
13
|
+
adapter: trino
|
|
14
|
+
|
|
15
|
+
# default client name sent to the db
|
|
16
|
+
client_name: Strata
|
|
17
|
+
|
|
18
|
+
# Max allowed time a query can run on this Datasource before manual time out
|
|
19
|
+
query_timeout: 3600
|
|
20
|
+
|
|
21
|
+
# Required: Trino server host
|
|
22
|
+
host: localhost
|
|
23
|
+
|
|
24
|
+
# Optional: Port number (default: 8080)
|
|
25
|
+
port: 8080
|
|
26
|
+
|
|
27
|
+
# Required: Catalog to connect to
|
|
28
|
+
catalog: native
|
|
29
|
+
|
|
30
|
+
# Required: Username for connection
|
|
31
|
+
username: strata_user
|
|
32
|
+
|
|
33
|
+
# Optional: Schema name
|
|
34
|
+
# schema: default
|
|
35
|
+
|
|
36
|
+
# Optional: Enable SSL (default: false)
|
|
37
|
+
ssl: false
|
|
38
|
+
|
|
39
|
+
# You can set password here. But to set password securely please run:
|
|
40
|
+
# `strata ds auth <%= @ds_key %>`
|
|
41
|
+
# This command will save your credentials to the .strata global or local file.
|
|
42
|
+
# password:
|
|
43
|
+
|
|
44
|
+
# Extra connection properties will forward these along when
|
|
45
|
+
# connecting to your Trino server.
|
|
46
|
+
# extra_connection_params:
|
|
47
|
+
# verify: false
|
|
48
|
+
# headers:
|
|
49
|
+
# X-Custom-Header: value
|
|
50
|
+
|
|
51
|
+
# Extra query params will forward these params when executing a
|
|
52
|
+
# query against your Trino servers:
|
|
53
|
+
# extra_query_params:
|
|
54
|
+
# headers:
|
|
55
|
+
# X-TRINO-USER: ${current_user_name}
|
|
56
|
+
# X-TRINO-SOURCE: STRATA CLI
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated by: strata create migration rename
|
|
2
|
+
# Migration hook: pre (before processing, default) or post (after processing)
|
|
3
|
+
#
|
|
4
|
+
# IMPORTANT: Renaming on non-production branch could cause issues with
|
|
5
|
+
# current production Queryables. They will be referencing the old named
|
|
6
|
+
# entities which will not exist in their branch. Consider only renaming
|
|
7
|
+
# on production branch.
|
|
8
|
+
# Pre-migration renames are common (prevents deletion of old entity).
|
|
9
|
+
# Post-migration renames are rare (after all entities are loaded).
|
|
10
|
+
|
|
11
|
+
- type: rename
|
|
12
|
+
hook: <hook>
|
|
13
|
+
entity: <entity_type>
|
|
14
|
+
from: <from_name>
|
|
15
|
+
to: <to_name>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Generated by: strata create migration swap
|
|
2
|
+
# Migration hook: pre (before processing) or post (after processing, default)
|
|
3
|
+
#
|
|
4
|
+
# IMPORTANT: Swap operations preserve both source and target fields.
|
|
5
|
+
# All references to the source field will be updated to use the target field.
|
|
6
|
+
# Post-migration swaps are common (after all entities are loaded).
|
|
7
|
+
# Pre-migration swaps are rare (before processing new definitions).
|
|
8
|
+
|
|
9
|
+
- type: swap
|
|
10
|
+
hook: <hook>
|
|
11
|
+
entity: <entity_type>
|
|
12
|
+
from: <from_name>
|
|
13
|
+
to: <to_name>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This file will control how this project is configured on your
|
|
2
|
+
# target Strata servers.
|
|
3
|
+
|
|
4
|
+
# Display name of the Project. Must be Unique per Strata instance.
|
|
5
|
+
name: <%= name %>
|
|
6
|
+
|
|
7
|
+
# UID is a URL friendly ID used in API requests for the project.
|
|
8
|
+
# Required and must be Unique
|
|
9
|
+
uid: <%= uid %>
|
|
10
|
+
description: Your projects description
|
|
11
|
+
|
|
12
|
+
# Target Strata server (default environment, typically dev)
|
|
13
|
+
server: <%= options[:source] || "http://localhost:3000" %>
|
|
14
|
+
|
|
15
|
+
# Alternatively, you can configure multiple environments (different Strata server instances).
|
|
16
|
+
# Each environment represents a separate Strata cluster (dev, staging, production).
|
|
17
|
+
# Use -e [ENVIRONMENT] flag when deploying to select the environment.
|
|
18
|
+
# Example:
|
|
19
|
+
# dev:
|
|
20
|
+
# server: http://localhost:3000
|
|
21
|
+
# prod:
|
|
22
|
+
# server: https://app.strata.com
|
|
23
|
+
|
|
24
|
+
# Project ID will be automatically set after first deployment.
|
|
25
|
+
# WARNING: Do not change this project_id. It links this project to the Strata server.
|
|
26
|
+
# Changing it may result in creating a new project or deployment failures.
|
|
27
|
+
# project_id:
|
|
28
|
+
|
|
29
|
+
# The production branch. This will be the branch used by
|
|
30
|
+
# default. Only developers can actually change branches for
|
|
31
|
+
# testing in th app.
|
|
32
|
+
production_branch: main
|
|
33
|
+
|
|
34
|
+
# The full repo url. This is only used to assist other
|
|
35
|
+
# users intializing an existing strata project.
|
|
36
|
+
git:
|