Class SystemViews

java.lang.Object
dev.frostlake.system.SystemViews

public class SystemViews extends Object
  • Constructor Details

    • SystemViews

      public SystemViews(Catalog catalog)
  • Method Details

    • queryDatabases

      public ResultSet queryDatabases()
    • querySchemata

      public ResultSet querySchemata(String databaseName)
    • queryTables

      public ResultSet queryTables(String databaseName, String schemaName)
      INFORMATION_SCHEMA.TABLES — every table-shaped object in the database, not just base tables.

      Live Snowflake (verified against a database holding one of each) lists views, materialized views and dynamic tables here alongside tables, and reports TABLE_TYPE from a four-value vocabulary:

      • BASE TABLE — a permanent table, a transient table (told apart by IS_TRANSIENT) and a dynamic table alike;
      • LOCAL TEMPORARY — a temporary table;
      • VIEW — a view;
      • MATERIALIZED VIEW — a materialized view.

      Snowflake also uses EXTERNAL TABLE, which Frostlake has no concept of. "TRANSIENT TABLE" and "TEMPORARY TABLE" — the values emitted before — are not Snowflake vocabulary at all; as live, transience is carried by IS_TRANSIENT instead, which keeps the Y/N spelling it shares with the DATABASES and SCHEMATA views here (live spells it YES/NO).

    • queryColumns

      public ResultSet queryColumns(String databaseName, String schemaName, String tableName)
      INFORMATION_SCHEMA.COLUMNS — one row per column of every table-shaped object, VIEWS AND MATERIALIZED VIEWS INCLUDED.

      Live Snowflake (verified on a real account, over a table carrying a spread of types) reports a view's columns in exactly the same row shape as a table's — same DATA_TYPE vocabulary, same precision/scale/length — so a browsing tool that lists views (which getTables does) can expand one and see its columns. Three of the columns are NOT inherited from the base table, all three measured:

      • COLUMN_DEFAULT is null for a view over a column that has a DEFAULT;
      • IS_IDENTITY is NO for a view over an IDENTITY column;
      • IS_PRIMARY_KEY is NO — a view has no constraints.

      IS_NULLABLE, by contrast, IS inherited live: a view over a NOT NULL column reports NO. Frostlake reports YES for every view column, because the nullability of a projected expression is not something the projection channel carries — the one deliberate divergence here, and the lenient direction of it.

      What a view reports comes off View.getResolvedColumns(), frozen when the view was created; nothing in this method plans a query, so a metadata read can never re-enter the metadata layer that serves it.

    • queryViews

      public ResultSet queryViews(String databaseName, String schemaName)
    • queryTableConstraints

      public ResultSet queryTableConstraints(String databaseName, String schemaName)
    • queryReferentialConstraints

      public ResultSet queryReferentialConstraints(String databaseName, String schemaName)
    • queryProcedures

      public ResultSet queryProcedures(String databaseName, String schemaName)
    • queryFunctions

      public ResultSet queryFunctions(String databaseName, String schemaName)
    • querySequences

      public ResultSet querySequences(String databaseName, String schemaName)
    • queryStages

      public ResultSet queryStages(String databaseName, String schemaName)
    • queryPipes

      public ResultSet queryPipes(String databaseName, String schemaName)
    • queryEnabledRoles

      public ResultSet queryEnabledRoles()
    • queryApplicableRoles

      public ResultSet queryApplicableRoles()
    • queryTablePrivileges

      public ResultSet queryTablePrivileges(String databaseName, String schemaName)
    • queryObjectPrivileges

      public ResultSet queryObjectPrivileges()
    • queryUsagePrivileges

      public ResultSet queryUsagePrivileges()
    • queryFileFormats

      public ResultSet queryFileFormats(String databaseName, String schemaName)
      Column shape measured on a real account; the per-option columns read the format's own options, so a CREATE FILE FORMAT written with any of them reports them back here.
    • queryHybridTables

      public ResultSet queryHybridTables(String databaseName, String schemaName)
    • queryTableStorageMetrics

      public ResultSet queryTableStorageMetrics(String databaseName, String schemaName)
      Byte counts are all zero: this engine stores rows in memory and keeps no byte accounting, no time-travel copies and no fail-safe, so zero is the honest figure for each.
    • queryInformationSchemaCatalogName

      public ResultSet queryInformationSchemaCatalogName(String databaseName)
      One row naming the database whose INFORMATION_SCHEMA is being read.