ACTIVE_BRANCH()
ACTIVE_BRANCH()
function returns the name of the currently active branch for this session.DOLT_MERGE_BASE()
DOLT_MERGE_BASE()
returns the hash of the common ancestor between two branches. Given the following branch structure:E
:HASHOF()
HASHOF()
function returns the commit hash of a branch or other commit spec.DOLT_VERSION()
DOLT_VERSION()
function returns the version string for the Dolt binary.DOLT_DIFF()
function and table functions have several restrictions in how they can be used in queries. For example, you cannot currently alias a table function or join a table function with another table or table function.DOLT_DIFF()
DOLT_DIFF()
table function calculates the differences in a table's data at any two commits in the database. Each row in the result set describes how a row in the underlying table has changed between the two commits, including the row's values at to and from commits and the type of change (i.e. added
, modified
, or removed
). DOLT_DIFF()
is an alternative to the dolt_commit_diff_$tablename
system table. You should generally prefer the system tables when possible, since they have less restrictions on use. However, some use cases, such as viewing a table data diff containing schema changes, can be easier to view with the DOLT_DIFF
table function.DOLT_DIFF()
table function and the dolt_commit_diff_$tablename
system table is the schema of the returned results. dolt_commit_diff_$tablename
generates the resulting schema based on the table's schema at the currently checked out branch. DOLT_DIFF()
will use the schema at the from_commit
for the from_
columns and the schema at the to_commit
for the to_
columns. This can make it easier to view diffs where the schema of the underlying table has changed.DOLT_DIFF()
table function currently has restrictions on how it can be used in queries. It does not support aliasing or joining with other tables, and argument values must currently be literal values.DOLT_DIFF()
table function takes three required arguments:tablename
— the name of the table containing the data to difffrom_revision
— the revision of the table data for the start of the diff. This may be a commit, tag, branch name, or other revision specifier (e.g. "main~").to_revision
— the revision of the table data for the end of the diff. This may be a commit, tag, branch name, or other revision specifier (e.g. "main~").from_commit
and at the to_commit
. For every column X
in your table at the from_commit
revision, there is a column in the result set named from_X
. Likewise, for every column Y
in your table at the to_commit
revision, there is a column in the result set named to_Y
. This is the major difference between the DOLT_DIFF()
table function and the dolt_commit_diff_$tablename
system table – DOLT_DIFF()
uses the two schemas at the to_commit
and from_commit
revisions to form the to and from columns of the result set, while dolt_commit_diff_$tablename
uses only the table schema of the currently checked out branch to form the to and from columns of the result set.inventory
in a database with two branches: main
and feature_branch
. We can use the DOLT_DIFF()
function to calculate a diff of the table data from the main
branch to the feature_branch
branch to see how our data has changed on the feature branch.inventory
at the tip of main
:inventory
at the tip of feature_branch
:DOLT_DIFF()
will be:DOLT_DIFF()
show how the data has changed going from main
to feature_branch
:DOLT_ADD()
DOLT_CHECKOUT()
DOLT_COMMIT()
DOLT_FETCH()
DOLT_MERGE()
DOLT_RESET()
DOLT_PUSH()
DOLT_PULL()