@@ -137,106 +137,106 @@ First, add the connections to your configuration and set the `gateway_managed_vi
137137
138138=== "YAML"
139139
140- ``` yaml linenums="1" hl_lines="30"
141- gateways :
142- redshift :
143- connection :
144- type : redshift
145- user : <redshift_user>
146- password : <redshift_password>
147- host : <redshift_host>
148- database : <redshift_database>
149- variables :
150- gw_var : ' redshift'
151- athena :
152- connection :
153- type : athena
154- aws_access_key_id : <athena_aws_access_key_id>
155- aws_secret_access_key : <athena_aws_secret_access_key>
156- s3_warehouse_location : <athena_s3_warehouse_location>
157- variables :
158- gw_var : ' athena'
159- snowflake :
160- connection :
161- type : snowflake
162- account : <snowflake_account>
163- user : <snowflake_user>
164- database : <snowflake_database>
165- warehouse : <snowflake_warehouse>
166- variables :
167- gw_var : ' snowflake'
140+ ```yaml linenums="1" hl_lines="30"
141+ gateways:
142+ redshift:
143+ connection:
144+ type: redshift
145+ user: <redshift_user>
146+ password: <redshift_password>
147+ host: <redshift_host>
148+ database: <redshift_database>
149+ variables:
150+ gw_var: 'redshift'
151+ athena:
152+ connection:
153+ type: athena
154+ aws_access_key_id: <athena_aws_access_key_id>
155+ aws_secret_access_key: <athena_aws_secret_access_key>
156+ s3_warehouse_location: <athena_s3_warehouse_location>
157+ variables:
158+ gw_var: 'athena'
159+ snowflake:
160+ connection:
161+ type: snowflake
162+ account: <snowflake_account>
163+ user: <snowflake_user>
164+ database: <snowflake_database>
165+ warehouse: <snowflake_warehouse>
166+ variables:
167+ gw_var: 'snowflake'
168168
169- default_gateway : redshift
170- gateway_managed_virtual_layer : true
169+ default_gateway: redshift
170+ gateway_managed_virtual_layer: true
171171
172- variables :
173- gw_var : ' global'
174- global_var : 5
175- ` ` `
172+ variables:
173+ gw_var: 'global'
174+ global_var: 5
175+ ```
176176
177177=== "Python"
178178
179- ` ` ` python linenums="1" hl_lines="48"
180- from sqlmesh.core.config import (
181- Config,
182- ModelDefaultsConfig,
183- GatewayConfig,
184- RedshiftConnectionConfig,
185- AthenaConnectionConfig,
186- SnowflakeConnectionConfig,
187- )
188-
189- config = Config(
190- model_defaults=ModelDefaultsConfig(dialect="redshift"),
191- gateways={
192- " redshift " : GatewayConfig(
193- connection=RedshiftConnectionConfig(
194- user="<redshift_user>",
195- password="<redshift_password>",
196- host="<redshift_host>",
197- database="<redshift_database>",
179+ ```python linenums="1" hl_lines="48"
180+ from sqlmesh.core.config import (
181+ Config,
182+ ModelDefaultsConfig,
183+ GatewayConfig,
184+ RedshiftConnectionConfig,
185+ AthenaConnectionConfig,
186+ SnowflakeConnectionConfig,
187+ )
188+
189+ config = Config(
190+ model_defaults=ModelDefaultsConfig(dialect="redshift"),
191+ gateways={
192+ "redshift": GatewayConfig(
193+ connection=RedshiftConnectionConfig(
194+ user="<redshift_user>",
195+ password="<redshift_password>",
196+ host="<redshift_host>",
197+ database="<redshift_database>",
198+ ),
199+ variables={
200+ "gw_var": "redshift"
201+ },
198202 ),
199- variables={
200- " gw_var " : " redshift "
201- } ,
202- ) ,
203- " athena " : GatewayConfig(
204- connection=AthenaConnectionConfig(
205- aws_access_key_id="<athena_aws_access_key_id>" ,
206- aws_secret_access_key="<athena_aws_secret_access_key>",
207- region_name="<athena_region_name>",
208- s3_warehouse_location="<athena_s3_warehouse_location>" ,
203+ "athena": GatewayConfig(
204+ connection=AthenaConnectionConfig(
205+ aws_access_key_id="<athena_aws_access_key_id>" ,
206+ aws_secret_access_key="<athena_aws_secret_access_key>" ,
207+ region_name="<athena_region_name>",
208+ s3_warehouse_location="<athena_s3_warehouse_location>",
209+ ) ,
210+ variables={
211+ "gw_var": "athena"
212+ } ,
209213 ),
210- variables={
211- " gw_var " : " athena "
212- } ,
213- ) ,
214- " snowflake " : GatewayConfig(
215- connection=SnowflakeConnectionConfig(
216- account="<snowflake_account>" ,
217- user="<snowflake_user>",
218- database="<snowflake_database>",
219- warehouse="<snowflake_warehouse>" ,
214+ "snowflake": GatewayConfig(
215+ connection=SnowflakeConnectionConfig(
216+ account="<snowflake_account>" ,
217+ user="<snowflake_user>" ,
218+ database="<snowflake_database>",
219+ warehouse="<snowflake_warehouse>",
220+ ) ,
221+ variables={
222+ "gw_var": "snowflake"
223+ } ,
220224 ),
221- variables={
222- " gw_var " : " snowflake"
223- },
224- ),
225- },
226- default_gateway="redshift",
227- gateway_managed_virtual_layer=True,
228- variables={
229- " gw_var " : " global" ,
230- " global_var " : 5,
231- },
232- )
233- ```
225+ },
226+ default_gateway="redshift",
227+ gateway_managed_virtual_layer=True,
228+ variables={
229+ "gw_var": "global",
230+ "global_var": 5,
231+ },
232+ )
233+ ```
234234
235235Note that gateway-specific variables take precedence over global ones. In the example above, the ` gw_var ` used in a model will resolve to the value specified in the model's gateway.
236236
237237For further customization, you can also enable [ gateway-specific model defaults] ( ../guides/configuration.md#gateway-specific-model-defaults ) . This allows you to define custom behaviors, such as specifying a dialect with case-insensitivity normalization.
238238
239- The default gateway is ` redshift ` In the example configuration above , so all models without a ` gateway ` specification will run on redshift, as in this ` order_dates ` model:
239+ In the example configuration above the default gateway is ` redshift ` , so all models without a ` gateway ` specification will run on redshift, as in this ` order_dates ` model:
240240
241241``` sql linenums="1"
242242MODEL (
0 commit comments