Skip to content

Commit

Permalink
update file sink
Browse files Browse the repository at this point in the history
  • Loading branch information
spadhi7 committed Jul 12, 2023
1 parent 06f1dc3 commit f142e19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/sink/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileSink(Sink[FileSinkConfig, SinkReport]):
def __post_init__(self) -> None:
fpath = pathlib.Path(self.config.filename)
self.file = fpath.open("w")
self.file.write("[\n")
# self.file.write("[\n")
self.wrote_something = False

def write_record_async(
Expand All @@ -60,17 +60,17 @@ def write_record_async(
)

if self.wrote_something:
self.file.write(",\n")
self.file.write("\n")

json.dump(obj, self.file, indent=4)
json.dump(obj, self.file, indent=None)
self.wrote_something = True

self.report.report_record_written(record_envelope)
if write_callback:
write_callback.on_success(record_envelope, {})

def close(self):
self.file.write("\n]")
self.file.write("\n")
self.file.close()


Expand Down

0 comments on commit f142e19

Please sign in to comment.