<jupyter_start><jupyter_text>How to Download an S3 FileThis is a code demonstration to download something off the S3 bucket to work on a .db object locally on your C driveBA_<jupyter_code>#general imports 
import boto3
import sqlite3 
S3_Key_id='' #TODO enter the key id
S3_Secret_key='' #TODO enter the secret key 
bucket = "gtown-wildfire-ds"
S3_file = 'modis_and_scan_raw1.db' #TODO change this to whatever .db file on the s3 you want to dopwnload
savefileas = "testdownloaddb.db" #TODO chane this to whatever you want the file to be called locally
def download_s3_file(bucket_name, path_to_download, save_as=None):
    """
    function which downloads a file from the S3 bucket
    good to use for a .db object to use for SQL temporarily
    """
    client = boto3.client('s3', aws_access_key_id= S3_Key_id, aws_secret_access_key= S3_Secret_key)
    object_to_download = path_to_download
    client.download_file(bucket_name, object_to_download, save_as)
#use the function to download the file
download_s3_file(bucket, S3_file, save_as=savefileas)<jupyter_output><empty_output><jupyter_text>The file should be downloaded on whatever directory you are currently in. Testing it out to make sure it works:<jupyter_code>#connect to the .db file and get cursor
conn = sqlite3.connect(savefileas)
cursor = conn.cursor()
sql = """SELECT * FROM firms LIMIT 10"""
cursor.execute(sql)
cursor.fetchall()<jupyter_output><empty_output><jupyter_text>This appears to have succefully downloaded and read the .db object from the S3 bucket for access on local c-drive<jupyter_code>#close the connection
conn.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07296137339055794, 'fraction_numerical': 0.012875536480686695, 'mean_word_length': 5.688524590163935, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '562749', 'license': 'MIT', 'n_tokens_mistral': 540, 'n_tokens_neox': 529, 'n_words': 184, 'path': 'Storage/s3_download_db.ipynb', 'repo_name': 'georgetown-analytics/wildfires', 'size': '1631'}