DataJunction / dj

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

Renaming/Moving Nodes #989

Open shangyian opened 4 months ago

shangyian commented 4 months ago

Since a node's namespace is part of its name, moving a node from one namespace to another is the same as renaming a node. To keep renames a simple operation, we should change how we store queries to use node ids rather than node names.

That is, instead of storing the node query as:

SELECT 
  a1,
  b1
FROM default.repair_types

We replace default.repair_types with the node id (prepended with some characters to indicate that this is a node reference:

SELECT 
  a1,
  b1
FROM nref.12332

This node reference can then be parsed at node query retrieval time and replaced with the node name. This makes it so that renaming nodes will be a single operation rather than a series of operations where we parse and fix different parts of the node graph.