Open dataders opened 3 years ago
@swanderz All properties of the currently active connection profile are available from the target
context variable.
I also believe it's possible to "call" a materialization as a macro, and thereby avoid duplicating logic. dbt turns materializations into macros with names like materialization_view_default
. That's not exactly documented, though, or guaranteed to continue working the same in the future.
For clarity, anyways, I'd lean toward including both logical paths, with clear branching logic:
{% materialization view, adapter='synapse' %}
... common setup ...
{% if target.is_serverless %}
... hacky drop and recreate ...
{% else %}
... standard rename-swap-drop ...
{% endmaterialization %}
background
In Azure Synapse serverless you cannot:
sp_rename
andRENAME
is not supported)You can, however, do this for dedicated SQL pools, which is what most teams use.
question
@jtcohen6 is it possible to use a project-level boolean variable that will conditionally switch between using the default view materialization and the custom one below?
In my head I'm envisioning a custom materialization that would conditionally dispatch to either the
dbt-core
's default view materialization and this hacky, drop-and-recreate view materialization below based on ais_serverless
variable that defaults toFalse
.