node

The node block represents a vertex in a graph, hierarchy or flow.

Anonymous node blocks can be declared inside a graph, hierarchy or flow. They may also be declared as named resources at the top level of a mod and referenced via base from other nodes in a graph, hierarchy or flow.

Example Usage

node {
category = category.plugin_version
sql = <<-EOQ
select
digest as id,
left(split_part(digest,':',2),12) as title,
json_build_object(
'digest', digest,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin_version
where
name = 'turbot/ldap'
EOQ
}

Argument Reference

ArgumentTypeOptional?Description
argsMapOptionalA map of arguments to pass to the query.
baseflow ReferenceOptionalA reference to a named node resource that this node should source its definition from.
databaseStringOptionalA database connection reference, connection string, or Pipes workspace to query. If not specified, the default database will be used.
categoryBlockOptionalcategory blocks that specify display options for nodes with that category.
depthNumberOptionalAn integer to set the position of the node in a flow. The layout of the nodes is inferred from the query, however you can force placement with the depth argument if you need to override the default behavior. The depth argument is optional, and is only used by flow resources.
paramBlockOptionalparam blocks that defines the parameters that can be passed in to the query. param blocks may only be specified when the node is defined as a top-level (mod level), named resource.
queryQuery ReferenceOptionalA reference to a query resource that defines the query to run. You must either specify the query argument or the sql argument, but not both.
--search-pathStringOptionalSet a comma-separated list of connections to use as a custom search path for the query
--search-path-prefixStringOptionalSet a comma-separated list of connections to use as a prefix to the current search path for the query.
sqlStringOptionalAn SQL string to provide data for the node. You must either specify the query argument or the sql argument, but not both.
titleStringOptionalA plain text title to display for this node.

Data Format

Data must be provided in a format where each row represents a node (vertex). Significant columns are:

NameDescription
idA unique identifier for the node. id is required for nodes.
titleAn optional title to display for the node.
categoryAn optional display category. This must be the name of a category declared in the parent graph, flow, or hierarchy.
depthAn integer to set the position of the node in a flow. The layout of the nodes is inferred from the query, however you can force placement with the depth column if you need to override the default behavior. The depth column is optional, and is only used in flow resources.
propertiesA jsonb key/value map of properties to display for the node/edge when the user hovers over it. The properties column is optional.

The category, depth, and title may be specified either in the SQL results or in HCL. If both are specified, the value in the SQL result set has precedence.

More Examples

inline node in a graph

dashboard "node_ex_1" {
graph {
node {
category = category.plugin_version
sql = <<-EOQ
select
digest as id,
left(split_part(digest,':',2),12) as title,
json_build_object(
'digest', digest,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin_version
where
name = 'turbot/ldap'
EOQ
}
}
}

Reusable node with base

dashboard "node_ex_2" {
graph {
node {
base = node.plugin
}
}
}
node "plugin"{
category = category.plugin
sql = <<-EOQ
select
name as id,
name as title,
json_build_object(
'name', name,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin
EOQ
}

Reusable node with base passing args

dashboard "node_ex_3" {
graph {
node {
base = node.plugin
args = {
plugin_name = self.input.plugin_name.value
}
}
}
}
node "plugin"{
category = category.plugin
sql = <<-EOQ
select
name as id,
name as title,
json_build_object(
'name', name,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin
where
name = $1
EOQ
param "plugin_name" {}
}