You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you might find that you want to record a value every time for a column even while using the mechanism which uses null for values that have not changed - for this project for example: https://github.com/simonw/scrape-instances-social
Idea: a --always colname option which turns this on (and can be applied multiple times).
The text was updated successfully, but these errors were encountered:
Quick prototype of this feature - not fully tested, may not cover all the edge-cases:
diff --git a/git_history/cli.py b/git_history/cli.py
index f3a4c40..975da28 100644
--- a/git_history/cli.py+++ b/git_history/cli.py@@ -79,6 +79,13 @@ def cli():
is_flag=True,
help="Record full copies in the item_version table, not just the columns that changed since the previous version",
)
+@click.option(+ "always_columns",+ "-a",+ "--always",+ multiple=True,+ help="Record this column in the item_version table even if it has not changed",+)
@click.option("ignore", "--ignore", multiple=True, help="Columns to ignore")
@click.option(
"csv_",
@@ -130,11 +137,12 @@ def file(
namespace,
branch,
ids,
- ignore,
start_at,
start_after,
skip_hashes,
full_versions,
+ always_columns,+ ignore,
csv_,
dialect,
convert,
@@ -306,7 +316,7 @@ def file(
updated_values = {}
updated_columns = set()
- if item_is_new or item_full_hash_has_changed:+ if item_is_new or item_full_hash_has_changed or always_columns:
# TODO: delete-me
previous_item_hash = item_id_to_last_full_hash.get(item_id)
@@ -349,7 +359,9 @@ def file(
if column in RESERVED_SET:
continue
value = item_flattened.get(column)
- if value != previous_item.get(column):+ if column in always_columns or str(value) != str(+ previous_item.get(column)+ ):
updated_values[column] = value
updated_columns.add(column)
else:
Sometimes you might find that you want to record a value every time for a column even while using the mechanism which uses
null
for values that have not changed - for this project for example: https://github.com/simonw/scrape-instances-socialIdea: a
--always colname
option which turns this on (and can be applied multiple times).The text was updated successfully, but these errors were encountered: