incremental.sql 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- Copyright 2020 Josh Wills. All rights reserved.
  2. -- Copyright Materialize, Inc. and contributors. All rights reserved.
  3. --
  4. -- Licensed under the Apache License, Version 2.0 (the "License");
  5. -- you may not use this file except in compliance with the License.
  6. -- You may obtain a copy of the License in the LICENSE file at the
  7. -- root of this repository, or online at
  8. --
  9. -- http://www.apache.org/licenses/LICENSE-2.0
  10. --
  11. -- Unless required by applicable law or agreed to in writing, software
  12. -- distributed under the License is distributed on an "AS IS" BASIS,
  13. -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. -- See the License for the specific language governing permissions and
  15. -- limitations under the License.
  16. {% materialization incremental, adapter='materialize' %}
  17. -- TL;DR: dbt-materialize does not support incremental models, use materialized_view
  18. -- models instead.
  19. -- Longer explanation:
  20. -- Incremental models are useful because instead of having to rebuild the entire table
  21. -- in your data warehouse, dbt will only apply your transformations to new data.
  22. -- Luckily, this is exactly what Materialize's materialized views do! As new data streams
  23. -- in, Materialize only performs work on that new data. And, all this happens without
  24. -- extra configurations or scheduled refreshes.
  25. -- For more information, please visit: https://materialize.com/docs/
  26. {{ exceptions.CompilationError(
  27. """
  28. dbt-materialize does not support incremental models, because all views in
  29. Materialize are natively maintained incrementally.
  30. Use the `materialized_view` custom materialization instead.
  31. See: https://materialize.com/docs/overview/api-components/#materialized-views
  32. See: https://docs.getdbt.com/reference/warehouse-profiles/materialize-profile#materializations
  33. """
  34. )}}
  35. {% endmaterialization %}