Skip to content

Commit b1045d6

Browse files
committed
Improve logging to allow checking data
1 parent a5fd626 commit b1045d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

switch_model/wecc/get_inputs/get_inputs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@
2020

2121
def write_csv_from_query(cursor, fname: str, headers: List[str], query: str):
2222
"""Create CSV file from cursor."""
23-
print(f"\t{fname}.csv... ", flush=True)
23+
print(f"\t{fname}.csv... ", flush=True, end="")
2424
cursor.execute(query)
2525
data = cursor.fetchall()
2626
write_csv(data, fname, headers, log=False)
27+
print(len(data))
2728
if not data:
2829
warnings.warn(f"File {fname} is empty.")
2930

3031

3132
def write_csv(data: Iterable[List], fname, headers: List[str], log=True):
3233
"""Create CSV file from Iterable."""
3334
if log:
34-
print(f"\t{fname}.csv... ", flush=True)
35+
print(f"\t{fname}.csv... ", flush=True, end="")
3536
with open(fname + ".csv", "w") as f:
3637
f.write(",".join(headers) + "\n")
3738
for row in data:
@@ -42,6 +43,8 @@ def write_csv(data: Iterable[List], fname, headers: List[str], log=True):
4243
f.write(
4344
",".join(row_as_clean_strings) + "\n"
4445
) # concatenates "line" separated by commas, and appends \n
46+
if log:
47+
print(len(data))
4548

4649

4750
# List of modules that is used to generate modules.txt

0 commit comments

Comments
 (0)