<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Isaac Warren on Medium]]></title>
        <description><![CDATA[Stories by Isaac Warren on Medium]]></description>
        <link>https://medium.com/@isaac_59629?source=rss-edeba6296b29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yqBpOpcVjgd_E_Gu</url>
            <title>Stories by Isaac Warren on Medium</title>
            <link>https://medium.com/@isaac_59629?source=rss-edeba6296b29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:17:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isaac_59629/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Bodo to Read and Write AWS S3 Tables in Python]]></title>
            <link>https://medium.com/bodo-ai/using-bodo-to-read-and-write-aws-s3-tables-in-python-49313be52f65?source=rss-edeba6296b29------2</link>
            <guid isPermaLink="false">https://medium.com/p/49313be52f65</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[iceberg-table]]></category>
            <category><![CDATA[apache-iceberg]]></category>
            <dc:creator><![CDATA[Isaac Warren]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 16:08:13 GMT</pubDate>
            <atom:updated>2025-02-13T16:17:16.700Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQSzoB3Yxln9sOVsVch7WA.png" /></figure><p><a href="https://aws.amazon.com/s3/features/tables/">AWS S3 Tables</a> is a new service that simplifies <a href="https://iceberg.apache.org/">Iceberg</a> open table format usage by providing setup and maintenance of Iceberg tables automatically. This includes built-in table maintenance and optimization, which simplifies managing large datasets. However, the main option currently for using S3 Tables is Apache Spark, which requires complex configuration and a Java-based engine. Bodo addresses this challenge by providing simple S3 Tables usage in both Python and SQL, simplifying read and write of large tables with high performance and efficiency.</p><h3>What is Bodo?</h3><p><a href="https://github.com/bodo-ai/Bodo">Bodo</a> is an open-source, high-performance compute engine for Python data processing. Using an innovative auto-parallelizing just-in-time (JIT) compiler, Bodo simplifies scaling Python workloads from laptop to cluster without major code changes. Under the hood, Bodo relies on MPI-based high-performance computing (HPC) technology-making it both easier to use and often orders of magnitude faster than tools like Spark or Dask.</p><h3>S3 Tables in Python with Pandas APIs</h3><p>Bodo enables efficient querying and processing of S3 Tables without the need for complex infrastructure or data movement. Unlike traditional Spark-based approaches, Bodo enables efficient table operations directly in Python using familiar Pandas APIs to read and write Iceberg tables like normal dataframes. This means you can perform analytical queries, aggregations, and transformations on S3 Tables without needing to migrate data to another system or configure distributed frameworks manually.</p><p>To switch a script from running on a local dataset to a remote Iceberg table on S3 Tables, you just need the table bucket ARN and table namespace.</p><p>To access S3 Tables, make sure you have active AWS credentials (e.g. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set or credentials set in ~/.aws/config) and the necessary dependencies are installed and upgraded. Also, make sure the user associated with your credentials has the AmazonS3TablesFullAccess policy attached.</p><p>You can write a dataframe with Bodo to S3 Tables using the to_sql method of DataFrames.</p><pre>@bodo.jit<br>def write_table(df, namespace, bucket_arn):<br> df.to_sql(<br>     name=&quot;my_table&quot;,<br>     con=f&quot;iceberg+{bucket_arn}&quot;,<br>     schema=namespace,<br>     if_exists=&quot;replace&quot;,<br> )</pre><p>You can read a S3 Tables table into a dataframe with Bodo using the Pandas read_sql_table function.</p><pre>@bodo.jit<br>def read_table(bucket_arn, namespace, table_name):<br> df = pd.read_sql_table(<br>     table_name=table_name,<br>     con=f&quot;iceberg+{bucket_arn}&quot;,<br>     schema=namespace,<br> )<br> return df</pre><h3>Getting Started</h3><p>This feature is available in Bodo pip and Conda releases starting from 2025.1. To try it out on macOS or Linux, install Bodo with:</p><pre>pip install bodo bodosql bodo-iceberg-connector</pre><p>(Windows support is under active development.) For more <a href="https://github.com/bodo-ai/Bodo/tree/main/examples">examples</a>, see the Bodo <a href="https://docs.bodo.ai/latest/quick_start/quickstart_local_iceberg/#s3-tables">documentation</a> and our<a href="https://github.com/bodo-ai/Bodo"> GitHub repository</a>.‍</p><h3>End to End Example</h3><p>Here is a full example of how S3 Tables can be used alongside Bodo. First it sets up S3 Tables by creating a table bucket and a namespace within the table bucket. It then writes a table of random data that is read back and a simple aggregation is computed. The aggregation is written to a new table. Finally, it cleans up the created AWS resources.</p><pre>import os<br><br>import boto3<br>import numpy as np<br>import pandas as pd<br><br>import bodo<br><br>os.environ[&quot;AWS_REGION&quot;] = &quot;us-east-2&quot;<br><br># Create an S3 Tables Bucket table bucket and namespace<br>s3_tables_client = boto3.client(<br> &quot;s3tables&quot;,<br> region_name=os.environ.get(&quot;AWS_REGION&quot;, &quot;us-east-2&quot;),<br>)<br>bucket_arn = s3_tables_client.create_table_bucket(<br> name=&quot;my-bucket&quot; + str(np.random.randint(0, 9999)),<br>)[&quot;arn&quot;]<br>namespace = s3_tables_client.create_namespace(<br> tableBucketARN=bucket_arn,<br> namespace=[&quot;my_namespace&quot;],<br>)[&quot;namespace&quot;][0]<br><br>conn_str = f&quot;iceberg+{bucket_arn}&quot;<br><br><br>@bodo.jit<br>def write_table(conn_str, namespace):<br> &quot;&quot;&quot;Create a table in an S3 Tables bucket full of random data&quot;&quot;&quot;<br> df = pd.DataFrame(<br>     {<br>         &quot;A&quot;: np.random.randint(0, 100, (10_000,)),<br>         &quot;B&quot;: np.random.randint(0, 100, (10_000,)),<br>     }<br> )<br> df.to_sql(<br>     name=&quot;my_table&quot;,<br>     con=conn_str,<br>     schema=namespace,<br>     if_exists=&quot;replace&quot;,<br> )<br><br><br>@bodo.jit<br>def group_table(conn_str, namespace):<br> &quot;&quot;&quot;<br> Group a table by column A taking the sum<br> and write the result to a new table<br> &quot;&quot;&quot;<br> df = pd.read_sql_table(<br>     table_name=&quot;my_table&quot;,<br>     con=conn_str,<br>     schema=namespace,<br> )<br> df.groupby(&quot;A&quot;).sum().to_sql(<br>     name=&quot;my_table_grouped&quot;,<br>     con=conn_str,<br>     schema=namespace,<br>     if_exists=&quot;replace&quot;,<br> )<br><br><br>@bodo.jit<br>def read_group_table(conn_str, namespace):<br> &quot;&quot;&quot;Read my_table_grouped&quot;&quot;&quot;<br> df = pd.read_sql_table(<br>     table_name=&quot;my_table_grouped&quot;,<br>     con=conn_str,<br>     schema=namespace,<br> )<br> return df<br><br><br>write_table(conn_str, namespace)<br>group_table(conn_str, namespace)<br>print(read_group_table(conn_str, namespace))<br><br># Cleanup the S3 Tables tables, namesapce, and table bucket<br>s3_tables_client.delete_table(<br> tableBucketARN=bucket_arn,<br> namespace=namespace,<br> name=&quot;my_table&quot;,<br>)<br>s3_tables_client.delete_table(<br> tableBucketARN=bucket_arn,<br> namespace=namespace,<br> name=&quot;my_table_grouped&quot;,<br>)<br>s3_tables_client.delete_namespace(<br> tableBucketARN=bucket_arn,<br> namespace=namespace,<br>)<br>s3_tables_client.delete_table_bucket(<br> tableBucketARN=bucket_arn<br>)<br>‍<br><br></pre><p>Coupled with Bodo’s high-performance JIT compiler and MPI-based backend, you can now combine your favorite Python toolkits with the power of HPC-without complicated rewrites. Give Bodo a try and share your feedback on <a href="https://github.com/bodo-ai/Bodo">GitHub</a> or our <a href="https://bodocommunity.slack.com/join/shared_invite/zt-qwdc8fad-6rZ8a1RmkkJ6eOX1X__knA#/shared-invite/email">Slack</a> community!‍</p><p><em>Originally published at </em><a href="https://www.bodo.ai/blog/using-bodo-to-read-and-write-aws-s3-tables-in-python"><em>https://www.bodo.ai</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49313be52f65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bodo-ai/using-bodo-to-read-and-write-aws-s3-tables-in-python-49313be52f65">Using Bodo to Read and Write AWS S3 Tables in Python</a> was originally published in <a href="https://medium.com/bodo-ai">bodo.ai</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>