DataJunction / dj

A metrics platform.
http://datajunction.io
MIT License
35 stars 15 forks source link

Cleanup update_if_exists vs skip_if_exists. #1199

Closed agorajek closed 1 month ago

agorajek commented 1 month ago

Summary

I noticed that in the case of create_namespace() and create_tag() the argument update_if_exists was misleading. Adjusted it to skip_if_exists . The update if exist functionality is still possible through the get()/save() pattern.

Also found one more issue with the _deploy_namespaces() method of the project compile. It was erroring out because of existing namespaces, example:

  users.olek.project1.xp.source-controlled     tag         Tag users.olek.project1.xp.source-controlled successfully created (or updated)
  users.olek.project1                          namespace   {'message': 'Node namespace `users.olek.project1` already exists'}

Test Plan

Unit test plus test deployments of my example YAML project.

Now getting a warning if the namespace exists:

                                                                                                                      XP Nodes
                                                                                                     Deployment for Prefix: users.olek.project1

  Name                                         Type        Message
 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  users.olek.project1.xp.source-controlled     tag         Tag users.olek.project1.xp.source-controlled successfully created (or updated)
  users.olek.project1                          namespace   Namespace users.olek.project1 already exists
  users.olek.project1.xp                       namespace   Namespace users.olek.project1.xp already exists
  users.olek.project1.xp.foo-bar               dimension   Node users.olek.project1.foo-bar successfully created (or updated)
...

Deployment Plan

netlify[bot] commented 1 month ago

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
Latest commit 05a85b9388dd3a6beee545a91a0bd6c061ae7739
Latest deploy log https://app.netlify.com/sites/thriving-cassata-78ae72/deploys/6707220b8492b300089cb3c3