On this page

    Nessie Query Syntax preview

    By default, table references are applied to the current Nessie commit context (which was specified from your last USE SQL command). However, you can specify a different table reference point for the table in the query.

    Syntax
    FROM <table_path>
      [ AT { 
          REF[ERENCE] <reference>
          | BRANCH <branch_name>
          | TAG <tag_name>
          | COMMIT <commit_hash>
          | TIMESTAMP <timestamp>
        }
      ]
    

    Parameters

    <table_path>

    String

    The path of the table that you want to query. The table must be in the Nessie repository.

    Optional Parameters

    AT

    Specify a reference point for the current SQL session. When this parameter is omitted, the current reference point is used.

    • REF[ERENCE] <reference>: Identifies the branch, tag, commit, or timestamp that you want to use as the new commit reference point.
    • BRANCH <branch_name>: Changes the commit reference point to the specified branch.
    • TAG <tag_name>: Changes the commit reference point to the specified tag.
    • COMMIT <commit_hash>: Changes the commit reference point to the specified commit.
    • TIMESTAMP <timestamp>: Changes the commit reference point to the specified timestamp.
    .

    Examples

    Query a table using a (branch) reference point
    SELECT * 
      FROM nessie_repo.demo_table AT REF main_branch
    
    Query a table using a timestamp
    SELECT * 
      FROM nessie_repo.demo_table AT TIMESTAMP 2022-01-01 17:30:50.000