pratham hardcoding comments

This commit is contained in:
Pratham Soni
2024-06-05 12:00:54 -05:00
parent 8e51457949
commit a21b5e46a5
+6
View File
@@ -83,6 +83,7 @@ df['Contract Name'] = file_list
file_names = []
buttons = st.columns([0.4, 0.4, 0.2])
with buttons[1]:
#Use the st.session_state to handle the changes that are made when create batch button is pressed
if st.button("Create Batch"): # RECOMMENDATION - Use on-click to handle everything below this. Better in terms of re-running code.
myobj = { "client-bucket-name": client_bucket }
@@ -98,11 +99,16 @@ with buttons[1]:
landing_zone = 'contracts_landing_zone'
else:
st.write("Failed")
#Consider using a batch upload and upload all the files to the s3 client bucket at the same time instead of a for loop to improve effeciency
for uploaded_file in file_list:
#Using BytesIO seems unnecessary, and will cause processing delays, instead handle the stream directly
stringio = BytesIO(uploaded_file.getvalue())
stringio.seek(0)
s3_client.put_object(Bucket=client_bucket, Body=stringio.getvalue(), Key=
landing_zone+batch_id+'/'+str(uploaded_file.name))
#s3_client.put_object(Bucket=client_bucket, Body=uploaded_file,
# Key=landing_zone+batch_id+'/'+str(uploaded_file.name))
# TODO: Test this insert function with snowflake
upload_log = insert_upload_logs(batch_id, client, str(uploaded_file.name), datetime.now().strftime("%Y-%m-%d %H:%M:%S"), user_mail)