dolt
dolt copied to clipboard
Feature Request: Include csv as a dolt diff format option.
This exists dolt diff -r csv
.
$ dolt diff --help
NAME
dolt diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
dolt diff [options] [<commit>] [<tables>...]
dolt diff [options] <commit> <commit> [<tables>...]
DESCRIPTION
Show changes between the working and staged tables, changes between the working tables and the tables within a commit, or changes between tables at
two commits.
dolt diff [--options] [<tables>...]
This form is to view the changes you made relative to the staging area for the next commit. In other words, the differences are what you could
tell Dolt to further add but you still haven't. You can stage these changes by using dolt add.
dolt diff [--options] [--merge-base] <commit> [<tables>...]
This form is to view the changes you have in your working tables relative to the named <commit>. You can use HEAD to compare it with the latest
commit, or a branch name to compare with the tip of a different branch. If --merge-base is given, instead of using <commit>, use the merge
base of <commit> and HEAD. dolt diff --merge-base A is equivalent to dolt diff $(dolt merge-base A HEAD) and dolt diff
A...HEAD.
dolt diff [--options] [--merge-base] <commit> <commit> [<tables>...]
This is to view the changes between two arbitrary commit. If --merge-base is given, use the merge base of the two commits for the
"before" side. dolt diff --merge-base A B is equivalent to dolt diff $(dolt merge-base A B) B and dolt diff A...B.
dolt diff [--options] <commit>..<commit> [<tables>...]
This is synonymous to the above form (without the ..) to view the changes between two arbitrary commit.
dolt diff [--options] <commit>...<commit> [<tables>...]
This is to view the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both <commit>. dolt diff
A...B is equivalent to dolt diff $(dolt merge-base A B) B and dolt diff --merge-base A B. You can omit any one of <commit>,
which has the same effect as using HEAD instead.
The diffs displayed can be limited to show the first N by providing the parameter --limit N where N is the number of diffs to display.
To filter which data rows are displayed, use --where <SQL expression>. Table column names in the filter expression must be prefixed with
from_ or to_, e.g. to_COLUMN_NAME > 100 or from_COLUMN_NAME + to_COLUMN_NAME = 0.
OPTIONS
-d, --data
Show only the data changes, do not show the schema changes (Both shown by default).
-s, --schema
Show only the schema changes, do not show the data changes (Both shown by default).
--summary
Show summary of data changes
-r <result output format>, --result-format=<result output format>
How to format diff output. Valid values are tabular, sql, json. Defaults to tabular.
--where=<column>
filters columns based on values in the diff. See dolt diff --help for details.
--limit=<record_count>
limits to the first N diffs.
-c, --cached
Show only the unstaged data changes.
-sk, --skinny
Shows only primary key columns and any columns with data changes.
--merge-base
Uses merge base of the first commit and second commit (or HEAD if not supplied) as the first commit
Oops. Looks like CSV isn't supported here:
$ dolt diff -r csv
invalid output format: csv
This is because it's hard to interpret +/- as a column from a ui perspective.
As a workaround you can use the dolt_diff
system tables in a sql query and output those as CSV.
I've been using that workaround because of the lack of the dolt diff option. Can't there be a column that is a + or -?
Again the workaround is to use dolt sql -r csv
on the diff tables.