-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Dolt is a versionable MySQL database that can commit, branch, push, and pull just like a git repository. The diff output is similar enough to git's that PatchSet is able to parse it. However, the number of lines (or in Dolt's case the number of table rows) added/removed does not seem to get tracked correctly.
For a basic Dolt setup, see this a minimal example I made. Taking the diff string of the objects table from my example, I tried unsuccessfully to parse the additions/deletions with unidiff
from io import StringIO
from textwrap import dedent
from unidiff import PatchSet
dolt_diff = dedent("""
diff --dolt a/objects b/objects
--- a/objects @ 73hiqmiduef0sqtecba4fav7vuuvdk2l
+++ b/objects @ 1hq161cev9kkt6eukvap0jmrfeedvt9j
+-----+----+---------+------------------+
| | id | label | bbox |
+-----+----+---------+------------------+
| < | 1 | cat | [1, 2, 3, 4] |
| > | 1 | cat | [3, 4, 5, 6] |
| < | 2 | dog | [10, 20, 30, 40] |
| > | 2 | poodle | [10, 20, 30, 40] |
| < | 3 | dog | [5, 6, 7, 8] |
| > | 3 | bulldog | [5, 6, 7, 8] |
+-----+----+---------+------------------+
""")
patch_set = PatchSet(StringIO(dolt_diff))
for t, table in enumerate(patch_set):
table_name = table.path.split('@')[0].strip()
print(f'Dolt table {t}={table_name}: {table.added} additions / {table.removed} deletions')This outputs
Dolt table 0=objects: 0 additions / 0 deletions
Whereas it should've been 3 additions / 3 deletions from the <> syntax in the first ASCII column of the diff. Is there a way to support Dolt's table diffs?
Metadata
Metadata
Assignees
Labels
No labels