<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Dynamodb on The Edge Cases</title>
    <link>https://www.kylestratis.com/tags/dynamodb/</link>
    <description>Recent content in Dynamodb on The Edge Cases</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>© 2025</copyright>
    <lastBuildDate>Fri, 18 Sep 2026 22:04:36 -0400</lastBuildDate>
    <atom:link href="https://www.kylestratis.com/tags/dynamodb/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>DynamoDB Can Take a Static Table Name</title>
      <link>https://www.kylestratis.com/notes/dynamodb-can-take-a-static-table-name/</link>
      <pubDate>Fri, 19 Jan 2024 19:09:51 +0000</pubDate>
      <guid>https://www.kylestratis.com/notes/dynamodb-can-take-a-static-table-name/</guid>
      <description>&lt;p&gt;CDK autogenerates resource names for every resource in your stack. However some, like DynamoDB, can take a &lt;code&gt;table_name&lt;/code&gt; argument, making it a statically named resource. There are a lot of use cases this can benefit, one I&amp;rsquo;ve used it for was for a table that needed to be accessed by both dev and prod environments, and so needed to be recreated (using &lt;code&gt;from_table_attributes&lt;/code&gt; instead of &lt;code&gt;from_table_name&lt;/code&gt; so that we have access to any streams) for non-prod environments for access.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Creating a Model Instance with from_raw_data() in PynamoDB</title>
      <link>https://www.kylestratis.com/notes/creating-a-model-instance-with-from-raw-data-in-pynamodb/</link>
      <pubDate>Thu, 26 Jan 2023 19:16:08 +0000</pubDate>
      <guid>https://www.kylestratis.com/notes/creating-a-model-instance-with-from-raw-data-in-pynamodb/</guid>
      <description>&lt;p&gt;When using &lt;code&gt;from_raw_data&lt;/code&gt; in PynamoDB, you have to pass in the DynamoDB dict structure (&lt;code&gt;{&amp;quot;attribute_name&amp;quot;: {&amp;quot;S&amp;quot;: &amp;quot;value&amp;quot;}&lt;/code&gt;), not a plain dictionary. When 6.0.0 comes out, there will be &lt;code&gt;to_dict&lt;/code&gt; and &lt;code&gt;from_dict&lt;/code&gt; methods.&lt;/p&gt;&#xA;&lt;p&gt;Until &lt;code&gt;to_dict&lt;/code&gt; and &lt;code&gt;from_dict&lt;/code&gt; are released, use this to convert a Pynamo object to a dictionary:&#xA;&lt;code&gt;found_record_dict = found_record.__dict__.get(&amp;quot;attribute_values&amp;quot;, found_record.__dict__)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;proejct-source&#34;&gt;Proejct Source&lt;/h2&gt;</description>
    </item>
    <item>
      <title>DynamoDB Index Read and Write Capacity in PynamoDB</title>
      <link>https://www.kylestratis.com/notes/dynamodb-index-read-and-write-capacity-in-pynamodb/</link>
      <pubDate>Fri, 04 Feb 2022 19:42:30 +0000</pubDate>
      <guid>https://www.kylestratis.com/notes/dynamodb-index-read-and-write-capacity-in-pynamodb/</guid>
      <description>&lt;p&gt;When setting up a Global Secondary Index model in PynamoDB, the read and write capacity units have to be specified. These are &lt;a href=&#34;https://github.com/pynamodb/PynamoDB/issues/629#issuecomment-517898130&#34;&gt;not needed if not provisioning a table or index&lt;/a&gt;, yet are not optional. Arbitrary values can be used and nothing will be done with them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ModelIndex&lt;/span&gt;(GlobalSecondaryIndex):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Meta&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      index_name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;model-index&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      read_capacity_index &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;# Not used, since the table isn&amp;#39;t being provisioned&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      write_capacity_index &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      projection &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AllProjection&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  model_key &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; UnicodeAttribute(hash_key&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;)  &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>PynamoDB Field Aliases</title>
      <link>https://www.kylestratis.com/notes/pynamodb-field-aliases/</link>
      <pubDate>Fri, 04 Feb 2022 17:59:50 +0000</pubDate>
      <guid>https://www.kylestratis.com/notes/pynamodb-field-aliases/</guid>
      <description>&lt;p&gt;To give an alias to DynamoDB field with PynamoDB, use the &lt;code&gt;attr_name&lt;/code&gt; parameter for the appropriate attribute constructor:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Thread&lt;/span&gt;(Model):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Meta&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    table_name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Thread&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;forum_name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; UnicodeAttribute(hash_key&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# This attribute will be called &amp;#39;tn&amp;#39; in DynamoDB&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;thread_name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; UnicodeAttribute(null&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, attr_name&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;tn&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>PynamoDB Arguments</title>
      <link>https://www.kylestratis.com/notes/pynamodb-arguments/</link>
      <pubDate>Wed, 26 Jan 2022 04:37:46 +0000</pubDate>
      <guid>https://www.kylestratis.com/notes/pynamodb-arguments/</guid>
      <description>&lt;p&gt;In PynamoDB, when running a DynamoDB query, the first two positional arguments are the hash key (primary key) and filters for the range key (sort key). To do a filter expression without querying on the range key, explicitly provide the &lt;code&gt;filter_condition_expression&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        post&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; post &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; PostModel&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;query(&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            user_id,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            filter_condition&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;(PostModel&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;media_type &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;IMAGE&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt; PostModel&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;image_key&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;exists(),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            limit&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        )&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;```&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
