amazon-s3

Get filename from S3 bucket path

Get filename from S3 bucket path Question: I am getting the last modified file from S3 bucket using the below code: import boto3 import urllib.parse import json import botocore.session as bc import time from time import mktime from datetime import datetime print(‘Loading function’) def lambda_handler(event, context): s3_client = boto3.client("s3") list_of_s3_objs = s3_client.list_objects_v2(Bucket="mybucket", Prefix="folder/sub/") # Returns …

Total answers: 2

how to Read .Sql file stored in S3 containing multiple SQL statements

how to Read .Sql file stored in S3 containing multiple SQL statements Question: I have a .sql file stored in S3 location in AWS which contains multiple SQL statements separated by semi colon as below: Query1; _______________ Query2; _______________ Query3; tried using 2 methods in AWS Glue job to read this S3 .sql file but …

Total answers: 1

How to upload excel file to AWS S3 using an AWS lambda function in python

How to upload excel file to AWS S3 using an AWS lambda function in python Question: I have an excel file in generated from a Lamba function, stored in the /tmp/ folder, I want to store it in a S3 bucket, I have setup the permisions and the bucket, but when I complete the function …

Total answers: 2

with python, is there a way to load a polars dataframe directly into an s3 bucket as parquet

with python, is there a way to load a polars dataframe directly into an s3 bucket as parquet Question: looking for something like this: Save Dataframe to csv directly to s3 Python the api shows these arguments: https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.DataFrame.write_parquet.html but i’m not sure how to convert the df into a stream… Asked By: rnd om || …

Total answers: 1

S3 User Download Without Local File

S3 User Download Without Local File Question: I am creating a front end web app that connects to Wasabi for S3 storage. I currently have the ability to download a file from my web app, but it requires a local download on the server to send to the user. I am trying to send the …

Total answers: 1

Python – Reset BytesIO So Next File Isn't Appended

Python – Reset BytesIO So Next File Isn't Appended Question: I’m having a problem with BytesIO library in Python. I want to convert a pdf file that I have retrieved from an S3 bucket, and convert it into a dataframe using a custom function convert_bytes_to_df. The first pdf file is fine to convert to a …

Total answers: 1

Airflow task stuck in 'queued' state. Dependencies Blocking Task From Getting Scheduled

Airflow task stuck in 'queued' state. Dependencies Blocking Task From Getting Scheduled Question: I have the following Airflow DAG which uploads a single local file into an S3 bucket. # airflow related from airflow import DAG from airflow.operators.python import PythonOperator # other packages from datetime import datetime import boto3 with DAG( dag_id=’upload_to_s3′, start_date=datetime(2020, 5, 5), …

Total answers: 1

Airflow DAG can't find local file to upload on s3

Airflow DAG can't find local file to upload on s3 Question: I have created a DAG to upload a local file into a personal S3 Bucket. However, when accessing http://localhost:9099/home I get the following error: FileNotFoundError: [Errno 2] No such file or directory: ‘C:UsersplataOneDriveΥπολογιστήςprojects backupsairflow-sqlserverdagspricedata.xlsx’ Ariflow error – broken dag I have a Windows PC …

Total answers: 2

Get all File from Subfolder Boto3

Get all File from Subfolder Boto3 Question: I have this code to download all the files from a buckets AWS S3 import os import boto3 #initiate s3 resource s3 = boto3.resource(‘s3’) s3 = boto3.resource( ‘s3’, aws_access_key_id = ‘__________’, aws_secret_access_key = ‘________’, region_name = ‘______’ ) # select bucket my_bucket = s3.Bucket(‘MainBucket’) # download file into …

Total answers: 1

Know when upload to s3 bucket is complete

Know when upload to s3 bucket is complete Question: I am using boto3 to upload an image to my s3 bucket and the below proccess works fine. What I want is, how can I know when the upload process is complete. Maybe print ‘upload complete’ when done. How can I achieve this? Thanks in advance. …

Total answers: 1