Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
chore: handle pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Feb 7, 2024
1 parent 51abf4c commit d9ec7a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def dump_target_objects_to_clickhouse(
if len(objects_to_submit) % batch_size == 0:
sink.dump(objects_to_submit, many=True)
objects_to_submit = []
log.info(f"Last IDs: {obj.pk}")
log.info(f"Last ID: {obj.pk}")
time.sleep(sleep_time)

if limit and count == limit:
Expand All @@ -77,6 +77,7 @@ def dump_target_objects_to_clickhouse(
if objects_to_submit:
sink.dump(objects_to_submit, many=True)
count += len(objects_to_submit)
log.info(f"Last ID: {objects_to_submit[-1].pk}")

log.info(f"Dumped {count} objects to ClickHouse")

Expand Down Expand Up @@ -152,13 +153,13 @@ def add_arguments(self, parser):
parser.add_argument(
"--batch_size",
type=int,
default=1000,
default=10000,
help="number of objects to dump in a single batch",
)
parser.add_argument(
"--sleep_time",
type=int,
default=10,
default=1,
help="number of seconds to sleep between batches",
)

Expand Down Expand Up @@ -193,7 +194,7 @@ def handle(self, *args, **options):
log.error(message)
raise CommandError(message)

Sink = ModelBaseSink.get_sink_by_model(options["object"])
Sink = ModelBaseSink.get_sink_by_model_name(options["object"])
sink = Sink(connection_overrides, log)
dump_target_objects_to_clickhouse(
sink,
Expand Down
2 changes: 1 addition & 1 deletion event_sink_clickhouse/sinks/base_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def is_enabled(cls):
return enabled or waffle_flag.is_enabled()

@classmethod
def get_sink_by_model(cls, model):
def get_sink_by_model_name(cls, model):
"""
Return the sink instance for the given model
"""
Expand Down

0 comments on commit d9ec7a9

Please sign in to comment.