Dwh.dev documentation
  • What is Dwh.dev?
  • Features
    • Data catalog
      • PIPEs
      • Fancy SQL Highlight
    • Data Lineage
      • Object-level lineage
      • Column-level Lineage
      • In-query lineage
      • Navigation
      • JOIN and WHERE
      • Equals column lineage
      • Strong and Weak dependencies
      • Default and Virtual Columns
      • Implicit Types casting
      • Circle dependencies
      • Argument forwarding
    • TASKs
  • Integrations
    • Snowflake
      • Offline mode
      • Secured online mode
      • Snowflake Marketplace
    • DBT
    • ETL
    • BI
      • Looker
      • Other
    • API
  • Snowflake SQL Syntax and Behavior
    • Identifiers
    • Reusing column aliases
    • SELECT * ILIKE EXCLUDE REPLACE RENAME
    • Scalar functions name resolution special behavior
    • Functions overloading
    • CTE as an expression alias
    • ASOF Join
    • UDF named arguments
    • Objects auto renaming
    • Columns auto renaming
Powered by GitBook
On this page

Was this helpful?

  1. Features
  2. Data Lineage

Default and Virtual Columns

PreviousStrong and Weak dependenciesNextImplicit Types casting

Last updated 8 months ago

Was this helpful?

Default and Virtual Columns also contain information about data lineage. And as usual, nobody pays attention to it :)

-- default value
CREATE TABLE t1 (
  id1 int,
  id2 int default (id1 +1)
);

CREATE VIEW v1 AS
  SELECT *
  FROM t1
;

If during data transformations, only the id1 column is inserted into the T1 table, the lineage information will be lost.

At , we display it like this:

With Virtual columns, an even more precarious situation arises. It's impossible to insert data into a virtual column, and they will ALWAYS depend on other columns in the table.

-- virtual column
CREATE TABLE T2 (
  A INT,
  B INT,
  C INT,
  D INT AS (CASE WHEN A>0 THEN B ELSE C END)
);

CREATE VIEW v2 AS
  SELECT *
  FROM t2
;

At , we display it like this:

Dwh.dev
Youtube
Dwh.dev