nicholasyager / dbt-loom

A dbt-core plugin to weave together multi-project dbt-core deployments
The Unlicense
114 stars 18 forks source link

error when using deprecation_date at version level #25

Closed danielefrigo closed 11 months ago

danielefrigo commented 11 months ago

I created a model in my upstream project with a deprecation_date at model level, generated the manifest.yml and everything works fine in my downstream project. If I move the deprecation_date at version level, the downstream project parsing breaks with error:

  File "/home/daniele/.cache/pypoetry/virtualenvs/credem-poc-pkg-aG8EzHFC-py3.10/lib/python3.10/site-packages/dbt/parser/manifest.py", line 579, in check_for_model_deprecations
    if resolved_ref.deprecation_date < datetime.datetime.now().astimezone():
TypeError: '<' not supported between instances of 'str' and 'datetime.datetime'

The issue arises from dbt-core, but if I move all the models and configs into one single project, the error disappears, so I guess it's somehow related to dbt-loom node injection.

This is a sample yml config for the upstream project:

version: 2

models:
  - name: GESTORE
    access: public
    latest_version: 2

    config:
      contract:
        enforced: true

    columns:
      - name: customer_id
        data_type: string
        constraints:
          - type: not_null
          - type: primary_key
      - name: customer_name
        data_type: string

    versions:
      - v: 1
        deprecation_date: '2023-10-30'

      - v: 2 
        columns:
          - include: all
            exclude: [customer_name]
          - name: customer_desc
            data_type: string
nicholasyager commented 11 months ago

Thanks for making this issue, @danielefrigo! I'll do some digging to see the precise cause. I suspect that there might be a deserialization edge case for dates in the manifest, but we'll see what I find.

nicholasyager commented 11 months ago

Yep, this was a deserialization defect. I have a PR merged into main, and a new patch release will be cut shortly.

nicholasyager commented 11 months ago

Release 0.3.1 has been cut. Thanks for submitting this issue, and please let me know if anything else come up along the way.