cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Asset Bundles : how to conditionally set content of a template file

GeKo
Contributor

Hello,

since Asset Bundles is based on GO templating mechanism, I am wondering how it is possible to use IF-ELSE construct within a template file, to define which file content will be set in the generated file ( I want to have that in my custom template).

Example: I am providing a boolean variable "topic_sourcing" to the bundle init command. The following template file shall be set, depending on that variable:

 

---
version: "1.0"
{{- if .topic_sourcing }}
status: enabled
topics:
  - name: "my-name"
    table_name: "my-tablename"
{{- else }}
status: disabled   
{{- end }}

 

But after the bundle init command, it looks like there is no templating mechanism applied on the file, means the created file contains exactly the text shown above.

How can I populate a file content based on a variable during bundle init ??

1 ACCEPTED SOLUTION

Accepted Solutions

GeKo
Contributor

Never mind....I figured out the solution ๐Ÿ˜„

I just have to prefix my template file with ".tmpl", then it gets rendered correctly

View solution in original post

1 REPLY 1

GeKo
Contributor

Never mind....I figured out the solution ๐Ÿ˜„

I just have to prefix my template file with ".tmpl", then it gets rendered correctly

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now