Skip to content

Commit 1444052

Browse files
committed
Updated logs
1 parent 0d409df commit 1444052

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

push_file_to_lz.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,8 @@ def __patch_file(access_token, file_path, lz_url, table_name):
100100

101101
token_headers = {"Authorization": "Bearer " + access_token, "content-length": "0"}
102102
logger.debug("creating file in lake")
103-
# conversion_file_exists = False
104103

105-
# # Check if the file already exists in the lakehouse
106-
# if file_name == constants.CONVERSION_LOG_FILE_NAME:
107-
# response_code = get_file_from_lz(table_name, file_name)
108-
# if response_code == 200:
109-
# logger.debug(f"File {file_name} already exists in lakehouse.")
110-
# conversion_file_exists = True
111-
112-
# if not conversion_file_exists or file_name != constants.CONVERSION_LOG_FILE_NAME:
113-
# Code to create file in lakehouse
104+
# Code to create file in lakehouse
114105
response = requests.put(token_url_temp, data={}, headers=token_headers)
115106
logger.debug(response)
116107

@@ -123,7 +114,6 @@ def __patch_file(access_token, file_path, lz_url, table_name):
123114
logger.debug(token_url_temp)
124115
logger.debug("pushing data to file in lake")
125116

126-
# file_path = file_name
127117
# Code to push Data to Lakehouse
128118
with open(file_path, "rb") as file:
129119
file_contents = file.read()
@@ -143,30 +133,6 @@ def __patch_file(access_token, file_path, lz_url, table_name):
143133
raise
144134

145135

146-
# def get_file_from_lz(table_name, file_name):
147-
# logger.info(
148-
# f"trying to get file from lz. table_name={table_name}, file_name={file_name}"
149-
# )
150-
# access_token = __get_access_token(
151-
# os.getenv("APP_ID"), os.getenv("SECRET"), os.getenv("TENANT_ID")
152-
# )
153-
# token_headers = {"Authorization": "Bearer " + access_token, "content-length": "0"}
154-
# url = os.getenv("LZ_URL") + table_name + "/" + file_name
155-
# response = requests.get(url, headers=token_headers)
156-
# response_status_code = response.status_code
157-
# if response_status_code != 200:
158-
# logger.warning(
159-
# f"failed to get file from Landing Zone. Server responded with code {response_status_code}"
160-
# )
161-
# return None
162-
# local_file_path = os.path.join(utils.get_table_dir(table_name), file_name)
163-
# # Commented out to stop re-write
164-
# # with open(local_file_path, "wb") as local_file:
165-
# # for chunk in response.iter_content():
166-
# # local_file.write(chunk)
167-
# return response_status_code
168-
169-
170136
def get_file_from_lz(table_name, file_name):
171137
logger.info(
172138
f"trying to get file from lz. table_name={table_name}, file_name={file_name}"

0 commit comments

Comments
 (0)