Skip to content

Commit c11fc61

Browse files
author
Andy Huynh
authored
Merge pull request #7 from andyh1203/auto-create-output-dir
Create output dir if destination_path specified
2 parents 1d61e74 + 3e4582e commit c11fc61

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Change Log
22

3+
## [0.1.4] - 2022-02-10
4+
5+
- [#7](https://github.com/andyh1203/target-jsonl/pull/7)
6+
Create output dir if it does not exist
7+
38
## [0.1.3] - 2022-02-10
49

510
- [#3](https://github.com/andyh1203/target-jsonl/pull/3)
611
Add custom name config for filename
7-
- [#4](https://github.com/andyh1203/target-jsonl/pull/4)
12+
- [#5](https://github.com/andyh1203/target-jsonl/pull/5)
813
feat: add adjustment to decimal precision and update singer-python

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='target-jsonl',
9-
version='0.1.3',
9+
version='0.1.4',
1010
description='Singer.io target for writing JSON Line files',
1111
long_description=readme,
1212
long_description_content_type='text/markdown',

target_jsonl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import sys
88
from datetime import datetime
9+
from pathlib import Path
910

1011
import singer
1112
from jsonschema import Draft4Validator, FormatChecker
@@ -53,6 +54,8 @@ def persist_messages(
5354
validators[o['stream']].validate((o['record']))
5455

5556
filename = (custom_name or o['stream']) + timestamp_file_part + '.jsonl'
57+
if destination_path:
58+
Path(destination_path).mkdir(parents=True, exist_ok=True)
5659
filename = os.path.expanduser(os.path.join(destination_path, filename))
5760

5861
with open(filename, 'a', encoding='utf-8') as json_file:

0 commit comments

Comments
 (0)