manifold-cli 0.0.10 → 0.0.12
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 +4 -4
- data/README.md +15 -23
- data/lib/manifold/cli.rb +4 -5
- data/lib/manifold/services/vector_service.rb +9 -2
- data/lib/manifold/templates/vector_template.yml +1 -0
- data/lib/manifold/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83355b0f1c47db5081d22f62151431820af4b24d1bc43df571c68acc24b747fe
|
4
|
+
data.tar.gz: 8c6cb9cff9b68ca9001af2706b993fe0e81ebc54b0054d7f7452d81a87d8562f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8411214d613656f7a7d591cd463dd9e863aa84c0def4733f6f6d70273d8d1a6058545984b936db6f328dd2f77c69dbbc1d15a86e3bc953626523389d3f7b2a66
|
7
|
+
data.tar.gz: 2d3aa8049dce5dc2e11b46cf61b25639b5017753b81515c7503c41da8c9f1b55d792e6d39572aac0305a4d6cb0eec14c6e04f76062d58bade315333c2749279d
|
data/README.md
CHANGED
@@ -56,41 +56,25 @@ cd <project_name>
|
|
56
56
|
manifold add <data_project_name>
|
57
57
|
```
|
58
58
|
|
59
|
-
3. **Generate BigQuery Resource Definitions**
|
59
|
+
3. **Generate BigQuery Resource Definitions and Terraform Configuration**
|
60
60
|
|
61
|
-
After you fill out the manifold.yml file, this command generates the necessary BigQuery schema files based on the specified dimensions and metrics.
|
61
|
+
After you fill out the manifold.yml file, this command generates the necessary BigQuery schema files and Terraform configurations based on the specified dimensions and metrics.
|
62
62
|
|
63
63
|
```bash
|
64
|
+
# Generate with submodule configuration (default)
|
64
65
|
manifold generate
|
65
|
-
```
|
66
|
-
|
67
|
-
4. **Generate Terraform Configuration (Optional)**
|
68
|
-
|
69
|
-
Manifold can optionally generate Terraform configurations for managing your BigQuery resources. To generate both BigQuery schemas and Terraform configurations, use the `--tf` flag:
|
70
|
-
|
71
|
-
```bash
|
72
|
-
# Generate standard Terraform configuration
|
73
|
-
manifold generate --tf
|
74
66
|
|
75
|
-
# Generate
|
76
|
-
manifold generate --
|
67
|
+
# Generate with provider configuration (if needed)
|
68
|
+
manifold generate --no-submodule
|
77
69
|
```
|
78
70
|
|
79
71
|
This will create:
|
80
72
|
|
81
|
-
- A root `main.tf.json` file that sets up
|
73
|
+
- A root `main.tf.json` file that sets up workspace modules (by default) or includes provider configuration (with --no-submodule)
|
82
74
|
- Individual workspace configurations in `workspaces/<workspace_name>/main.tf.json`
|
83
75
|
- Dataset and table definitions that reference your generated BigQuery schemas
|
84
76
|
|
85
|
-
|
86
|
-
|
87
|
-
```bash
|
88
|
-
terraform init
|
89
|
-
terraform plan -var="project_id=your-project-id"
|
90
|
-
terraform apply -var="project_id=your-project-id"
|
91
|
-
```
|
92
|
-
|
93
|
-
When using `--submodule`, the generated configuration skips provider setup, allowing you to include the project as a module in a larger Terraform configuration:
|
77
|
+
By default, the generated Terraform configurations are designed to be included as a module in your larger Terraform configuration:
|
94
78
|
|
95
79
|
```hcl
|
96
80
|
module "my_manifold_project" {
|
@@ -99,6 +83,14 @@ module "my_manifold_project" {
|
|
99
83
|
}
|
100
84
|
```
|
101
85
|
|
86
|
+
If you need to use the configuration standalone (with `--no-submodule`), you can apply it directly:
|
87
|
+
|
88
|
+
```bash
|
89
|
+
terraform init
|
90
|
+
terraform plan -var="project_id=your-project-id"
|
91
|
+
terraform apply -var="project_id=your-project-id"
|
92
|
+
```
|
93
|
+
|
102
94
|
## Manifold Configuration
|
103
95
|
|
104
96
|
### Vectors
|
data/lib/manifold/cli.rb
CHANGED
@@ -45,16 +45,15 @@ module Manifold
|
|
45
45
|
logger.info "Added workspace '#{name}' with tables and routines directories."
|
46
46
|
end
|
47
47
|
|
48
|
-
desc "generate", "Generate BigQuery schema for all workspaces in the project"
|
49
|
-
method_option :
|
50
|
-
method_option :submodule, type: :boolean, default: false,
|
48
|
+
desc "generate", "Generate BigQuery schema and Terraform configurations for all workspaces in the project"
|
49
|
+
method_option :submodule, type: :boolean, default: true,
|
51
50
|
desc: "Generate Terraform configurations as a submodule (skips provider configuration)"
|
52
51
|
def generate
|
53
52
|
path = Pathname.pwd
|
54
53
|
name = path.basename.to_s
|
55
54
|
project = API::Project.new(name, directory: path, logger:)
|
56
|
-
project.generate(with_terraform:
|
57
|
-
logger.info "Generated BigQuery schema for all workspaces in the project."
|
55
|
+
project.generate(with_terraform: true, is_submodule: options[:submodule])
|
56
|
+
logger.info "Generated BigQuery schema and Terraform configurations for all workspaces in the project."
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
@@ -32,15 +32,22 @@ module Manifold
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def transform_attributes_to_schema(attributes)
|
35
|
-
attributes.map do |name,
|
35
|
+
attributes.map do |name, type_str|
|
36
|
+
type, mode = parse_type_and_mode(type_str)
|
36
37
|
{
|
37
38
|
"name" => name,
|
38
39
|
"type" => type.upcase,
|
39
|
-
"mode" =>
|
40
|
+
"mode" => mode
|
40
41
|
}
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
def parse_type_and_mode(type_str)
|
46
|
+
type, mode = type_str.split(":")
|
47
|
+
mode = mode&.upcase || "NULLABLE"
|
48
|
+
[type, mode]
|
49
|
+
end
|
50
|
+
|
44
51
|
def config_path(vector_name)
|
45
52
|
Pathname.pwd.join("vectors", "#{vector_name.downcase}.yml")
|
46
53
|
end
|
data/lib/manifold/version.rb
CHANGED