<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thad Guidry</title>
    <description>The latest articles on DEV Community by Thad Guidry (@thadguidry).</description>
    <link>https://dev.to/thadguidry</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1417872%2Fc03092f5-99bd-4309-ac4c-4644fa5ed679.jpeg</url>
      <title>DEV Community: Thad Guidry</title>
      <link>https://dev.to/thadguidry</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thadguidry"/>
    <language>en</language>
    <item>
      <title>How to connect and query multiple databases with a single REST API</title>
      <dc:creator>Thad Guidry</dc:creator>
      <pubDate>Fri, 18 Oct 2024 03:14:32 +0000</pubDate>
      <link>https://dev.to/thadguidry/how-to-connect-and-query-multiple-databases-with-a-single-rest-api-2jml</link>
      <guid>https://dev.to/thadguidry/how-to-connect-and-query-multiple-databases-with-a-single-rest-api-2jml</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;As a web developer or database admin, creating a single REST API for querying your databases together should be easy, but it is often quite difficult.&lt;/p&gt;

&lt;p&gt;What if you could &lt;strong&gt;skip using an ORM&lt;/strong&gt;, and use technology that auto-creates a REST API to query your databases together?&lt;/p&gt;

&lt;p&gt;Open-source &lt;a href="https://db2rest.com/docs/multidb/connect-multiple-db" rel="noopener noreferrer"&gt;DB2Rest&lt;/a&gt; can allow your frontend to access your multiple separate databases where DB2Rest automatically exposes a safe and secure REST API to easily query, join, or push data records to store into your databases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Config
&lt;/h2&gt;

&lt;p&gt;We can use a JSON structure (and provide the config as a large environment variable string) or use a YAML file to provide the configuration for DB2Rest to work with multiple databases.&lt;/p&gt;

&lt;p&gt;Here's an example of a YAML file which you can type or generate by whichever template mechanism you desire (for extra security, any values such as passwords can be replaced at instantiation time or after DB2Rest deployment).  Each database needs to be given a unique id of your choosing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;databases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB1&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;POSTGRESQL&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jdbc:postgresql://localhost:5432/homidb&lt;/span&gt;
      &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@Kolkata84"&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB2&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;MYSQL&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jdbc:mysql://localhost:3306/sakila&lt;/span&gt;
      &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@Kolkata84"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After saving configuration, or setting the environment variable string for config, we can start DB2Rest with a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;java &lt;span class="nt"&gt;-jar&lt;/span&gt; db2rest-1.2.3.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making REST API calls to multiple databases
&lt;/h2&gt;

&lt;p&gt;Once DB2Rest is running, we can make REST API calls from our application or frontend code to query, or insert data into our databases.  Let's see how to insert a record via curl into our &lt;code&gt;DB1&lt;/code&gt; database's &lt;code&gt;employee&lt;/code&gt; table.&lt;/p&gt;

&lt;p&gt;Notice the &lt;code&gt;url&lt;/code&gt; endpoint that DB2Rest created and exposes for you by automatically inspecting all schema &amp;amp; tables of your configured databases upon its startup:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POST Request&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;--request&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--url&lt;/span&gt; http://[IP_ADDRESS]:[PORT]/v1/rdbms/DB1/employee &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s1"&gt;'User-Agent: insomnia/8.6.1'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s1"&gt;'{
"first_name" : "Salman",
"last_name" : "Khan",
"email" : "sk@skfilms.com",
"created_on" : "2015-04-14T11:07:36.639Z"
}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTTP Response from DB2Rest after successful write&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"row"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"keys"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To store data records to &lt;code&gt;DB2&lt;/code&gt; we simply change the &lt;code&gt;url&lt;/code&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
curl --request POST \
--url http://[IP_ADDRESS]:[PORT]/v1/rdbms/DB2/employee \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/8.6.1' \
--data '{
"first_name" : "Salman",
"last_name" : "Khan",
"email" : "sk@skfilms.com",
"created_on" : "2015-04-14T11:07:36.639Z"
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Querying data
&lt;/h2&gt;

&lt;p&gt;Let's see how querying the table &lt;code&gt;employee&lt;/code&gt; from our &lt;code&gt;DB2&lt;/code&gt; looks like after we inserted the record previously.  Instead of &lt;a href="https://curl.se/" rel="noopener noreferrer"&gt;curl&lt;/a&gt;, let's use &lt;a href="https://httpie.io" rel="noopener noreferrer"&gt;httpie&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTPie Request&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http GET http://[IP_ADDRESS]:[PORT]/v1/rdbms/DB2/employee &lt;span class="se"&gt;\&lt;/span&gt;
User-Agent:insomnia/8.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTTP Response&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"first_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Salman"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"last_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Khan"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sk@skfilms.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"created_on"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2015-04-14T11:07:36.639+00:00"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Restricting Schema for multiple databases
&lt;/h2&gt;

&lt;p&gt;You can even restrict schema that will be exposed by DB2Rest's auto REST API.  This is done by using a &lt;code&gt;schemas&lt;/code&gt; add rule into the configuration of DB2Rest.&lt;/p&gt;

&lt;p&gt;Below, we want to limit the accessible schema (objects, tables) to only the &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;hrms&lt;/code&gt; schemas that DB2Rest will automatically create URL endpoints for us (no other schema will be reachable, and DB2Rest will immediately return an error response):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;databases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB1&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;POSTGRESQL&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jdbc:postgresql://localhost:5432/homidb&lt;/span&gt;
      &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@Kolkata84"&lt;/span&gt;
      &lt;span class="na"&gt;schemas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
       &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;public&lt;/span&gt;
       &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;hrms&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB2&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;MYSQL&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jdbc:mysql://localhost:3306/sakila&lt;/span&gt;
      &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@Kolkata84"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;POST Request&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http GET http://[IP_ADDRESS]:[PORT]/v1/rdbms/DB1/admin &lt;span class="se"&gt;\&lt;/span&gt;
User-Agent:insomnia/8.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTTP Error Response&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"errorCategory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Data-access-error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"timestamp:"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2015-04-14T11:07:36.639+00:00"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advanced Querying
&lt;/h2&gt;

&lt;p&gt;DB2Rest also supports &lt;a href="https://db2rest.com/docs/category/query" rel="noopener noreferrer"&gt;easy to use advanced querying and filtering&lt;/a&gt;, not only querying entire tables or inserting rows!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http GET &lt;span class="s1"&gt;'http://localhost:8080/v1/rdbms/DB1/employee?filter=last_name==Green'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
User-Agent:insomnia/8.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;even multiple filters can be combined, using operators such as AND &lt;code&gt;;&lt;/code&gt; (the official docs have many more examples of powerful expression syntax available)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http GET &lt;span class="s1"&gt;'http://localhost:8080/v1/rdbms/DB1/employee?filter=last_name==Green;first_name==David'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
User-Agent:insomnia/8.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information see the official docs at &lt;a href="https://db2rest.com/docs/intro" rel="noopener noreferrer"&gt;https://db2rest.com/docs/intro&lt;/a&gt; or join the &lt;a href="https://discord.gg/gytFPNW656" rel="noopener noreferrer"&gt;DB2Rest Discord channel&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>No-Code REST API for Databases adds Table Joins</title>
      <dc:creator>Thad Guidry</dc:creator>
      <pubDate>Thu, 15 Aug 2024 00:29:14 +0000</pubDate>
      <link>https://dev.to/thadguidry/no-code-rest-api-for-databases-adds-table-joins-mb2</link>
      <guid>https://dev.to/thadguidry/no-code-rest-api-for-databases-adds-table-joins-mb2</guid>
      <description>&lt;p&gt;Wouldn't it be great if you could easily have an API automatically create itself and without coding to ask a database to combine content from multiple tables and just give you a single JSON response that you can work with in your frontend application?  &lt;strong&gt;Without code generation that slows things down, or having to worry about mapping with an ORM, or even knowing much SQL at all?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://db2rest.com" rel="noopener noreferrer"&gt;DB2Rest&lt;/a&gt; builds on its &lt;a href="https://db2rest.com/docs/read/introduction-to-rsql" rel="noopener noreferrer"&gt;RSQL&lt;/a&gt; core to make it very easy to combine data from one table with another table and fetch the single result of data through DB2Rest's &lt;strong&gt;automatically provided REST API&lt;/strong&gt;. With &lt;a href="https://db2rest.com" rel="noopener noreferrer"&gt;DB2Rest&lt;/a&gt;, it is also very easy to retrieve rows and apply filters. Let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Join
&lt;/h2&gt;

&lt;p&gt;For real world applications data is often stored in multiple tables. In order to retrieve data from multiple tables, a join SQL command is typically used.  But DB2Rest simplifies things for you!&lt;/p&gt;

&lt;p&gt;DB2Rest supports the following SQL JOIN types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;INNER JOIN (also known as a ‘simple’ JOIN). This is the most common type of JOIN.&lt;/li&gt;
&lt;li&gt;LEFT JOIN (or LEFT OUTER JOIN)&lt;/li&gt;
&lt;li&gt;RIGHT JOIN (or RIGHT OUTER JOIN)&lt;/li&gt;
&lt;li&gt;FULL JOIN (or FULL OUTER JOIN)NOT SUPPORTED &lt;/li&gt;
&lt;li&gt;SELF JOIN&lt;/li&gt;
&lt;li&gt;CROSS JOIN&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Inner Join
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frr1elp3oz7x5uxtxn0mv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frr1elp3oz7x5uxtxn0mv.jpg" alt="2 overlapping circles showing a common set between them, an inner join" width="289" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;Inner Join&lt;/strong&gt; is the most commonly used, so we'll explain how to do this using DB2Rest.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;INNER&lt;/code&gt; selects records that have matching values in both tables (A) and (B).&lt;/p&gt;

&lt;p&gt;For example, using DB2Rest we can expand (join) a &lt;code&gt;review&lt;/code&gt; table (A) with data from a &lt;code&gt;film&lt;/code&gt; table (B) to retrieve all the reviews for each film.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTPie POST&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'[ \
    {"table":"film", \
     "fields":["title","release_year"], \
     "type":"INNER","on":["film_id==film_id"] \
    }]'&lt;/span&gt; | http POST &lt;span class="s1"&gt;'http://localhost:8080/v1/rdbms/db/review/_expand'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="s1"&gt;'Content-Type:application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="s1"&gt;'Accept:application/json'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice in the above &lt;code&gt;http POST&lt;/code&gt; syntax using &lt;a href="https://httpie.io/" rel="noopener noreferrer"&gt;HTTPie&lt;/a&gt; test client that we specified our first table using &lt;code&gt;/db/review/_expand&lt;/code&gt; which says that we want the &lt;code&gt;review&lt;/code&gt; table expanded with data from the &lt;code&gt;film&lt;/code&gt; table.  We further also added some expand (join) conditions &lt;code&gt;table, fields, type&lt;/code&gt; prior to the &lt;code&gt;http POST&lt;/code&gt; in a JSON Array payload.&lt;/p&gt;

&lt;p&gt;DB2Rest uses easy to use &lt;a href="https://db2rest.com/docs/read/supported-rsql-operators" rel="noopener noreferrer"&gt;RSQL expression syntax&lt;/a&gt; such as &lt;code&gt;==&lt;/code&gt; or &lt;code&gt;year=gt=2003&lt;/code&gt; or &lt;code&gt;year&amp;gt;2003&lt;/code&gt;.&lt;br&gt;
Combining filter conditions is painless using operators &lt;code&gt;AND&lt;/code&gt; or semicolon &lt;code&gt;;&lt;/code&gt; such as in this example: &lt;code&gt;http://localhost:8080/v1/rdbms/db/actor?filter=last_name==Roshan;actor_id==206&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The response from the HTTPie POST query is shown below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RESPONSE&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Content-Length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;174&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"review_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ABC123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Awesome movie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"rating"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"film_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ACADEMY DINOSAUR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"release_year"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2006-01-01"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"review_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"XYZ321"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Fantastic Movie!"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"rating"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"film_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ACADEMY DINOSAUR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"release_year"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2006-01-01"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Left Join
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj0t3s7d0365l8qcydjr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj0t3s7d0365l8qcydjr.jpg" alt="2 overlapping circles showing a common set between them and the set from the left circle, a left join" width="278" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;LEFT&lt;/code&gt; keyword returns all records/rows from the left table (A), and the matching records from the right table (B). The result is 0 records from the right side, if there is no match. &lt;/p&gt;

&lt;p&gt;Let's see the 2 tables we'll use in our next example: &lt;/p&gt;

&lt;p&gt;users (A):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;auid&lt;/th&gt;
&lt;th&gt;isActive&lt;/th&gt;
&lt;th&gt;username&lt;/th&gt;
&lt;th&gt;password&lt;/th&gt;
&lt;th&gt;createdate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;admin&lt;/td&gt;
&lt;td&gt;pswrd123&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;admin1&lt;/td&gt;
&lt;td&gt;pass506&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;toyota9&lt;/td&gt;
&lt;td&gt;pass12&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;fox12&lt;/td&gt;
&lt;td&gt;45@jgo0&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;dartaB&lt;/td&gt;
&lt;td&gt;79take19&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;td&gt;lexus1267&lt;/td&gt;
&lt;td&gt;98hnfRT6&lt;/td&gt;
&lt;td&gt;2024-03-10T00:00:00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;userprofile (B):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;apid&lt;/th&gt;
&lt;th&gt;auid&lt;/th&gt;
&lt;th&gt;firstname&lt;/th&gt;
&lt;th&gt;lastname&lt;/th&gt;
&lt;th&gt;email&lt;/th&gt;
&lt;th&gt;phone&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Jack&lt;/td&gt;
&lt;td&gt;Wolf&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:bettestroom@gmail.com"&gt;bettestroom@gmail.com&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;600075764216&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Chris&lt;/td&gt;
&lt;td&gt;Jones&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:jchris2@dottns.org"&gt;jchris2@dottns.org&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;+15552836716&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We want the users and their userprofile data only when the users ids match.  So let's ask for that using DB2Rest's automatically created API endpoint for our database.&lt;/p&gt;

&lt;p&gt;In the below query, we ask to &lt;code&gt;_expand&lt;/code&gt; our &lt;code&gt;users&lt;/code&gt; table (A) data with additional &lt;code&gt;fields&lt;/code&gt; and their data from the &lt;code&gt;userprofile&lt;/code&gt; table (B)&lt;br&gt;
only when the &lt;code&gt;users&lt;/code&gt; table &lt;code&gt;auid&lt;/code&gt; field value matches the &lt;code&gt;auid&lt;/code&gt; values in our &lt;code&gt;userprofile&lt;/code&gt; table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'[ \
    {"table":"userprofile", \
     "fields":["auid","apid","firstname","lastname","email","phone"], \
     "type":"LEFT","on":["auid==auid"] \
    }]'&lt;/span&gt; | http POST &lt;span class="s1"&gt;'http://localhost:8080/v1/rdbms/db/users/_expand'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="s1"&gt;'Content-Type:application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="s1"&gt;'Accept:application/json'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return the following result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Content-Length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;730&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"auid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"pswrd123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2024-03-10T00:00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"isActive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"firstname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Jack"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lastname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Wolf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bettestroom@gmail.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"600075764216"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"auid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"admin1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"pass506"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2024-03-10T00:00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"isActive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"firstname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lastname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"auid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fox12"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"45@jgo0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2024-03-10T00:00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"isActive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"firstname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lastname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"auid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lexus1267"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"98hnfRT6"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2024-03-10T00:00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"isActive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"firstname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lastname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice we did not return the &lt;code&gt;userprofile&lt;/code&gt; for &lt;code&gt;Chris Jones&lt;/code&gt; because the &lt;code&gt;auid&lt;/code&gt; values for that user from both tables did not match.&lt;/p&gt;

&lt;h2&gt;
  
  
  SUMMARY
&lt;/h2&gt;

&lt;p&gt;DB2Rest allows you to spin up an automatically created API for your databases.  There is no ORM column mapping needed or generated code produced that you have to hack further (saving 100's of hours sometimes!).  Instead DB2Rest uses simplified familiar JSON and URL query parameter syntax (not SQL) to get results.&lt;/p&gt;

&lt;p&gt;DB2Rest has much more documentation such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how to count rows&lt;/li&gt;
&lt;li&gt;how to delete records/rows from a table&lt;/li&gt;
&lt;li&gt;how to add records/rows to a table&lt;/li&gt;
&lt;li&gt;how to use table aliases&lt;/li&gt;
&lt;li&gt;how to use pagination for large result sets&lt;/li&gt;
&lt;li&gt;how to restrict schemas&lt;/li&gt;
&lt;li&gt;how to connect multiple databases&lt;/li&gt;
&lt;li&gt;and more!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Visit DB2Rest official website: &lt;a href="https://db2rest.com" rel="noopener noreferrer"&gt;https://db2rest.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>database</category>
      <category>api</category>
      <category>sql</category>
    </item>
    <item>
      <title>Instant API for databases adds automatic TSID primary keys</title>
      <dc:creator>Thad Guidry</dc:creator>
      <pubDate>Sun, 05 May 2024 06:49:47 +0000</pubDate>
      <link>https://dev.to/thadguidry/instant-api-for-databases-adds-automatic-primary-keys-5cpk</link>
      <guid>https://dev.to/thadguidry/instant-api-for-databases-adds-automatic-primary-keys-5cpk</guid>
      <description>&lt;p&gt;In a &lt;a href="https://dev.to/thadguidry/expose-your-database-as-a-rest-api-safely-and-without-code-5242"&gt;previous post&lt;/a&gt;, we saw how we can read and write data through an &lt;strong&gt;instant API&lt;/strong&gt; provided by &lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt;.  It would be nice to have a way to automatically create chronological sequences of our written data so we do not have to code anything extra in our application when writing data out through our API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of TSIDs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt; has a built-in ability to automatically create Time-Sorted Unique Identifiers (&lt;a href="https://www.wikidata.org/wiki/Q125756633"&gt;TSID&lt;/a&gt;) that offer benefits such as the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chronologically sorted like integers.&lt;/li&gt;
&lt;li&gt;Compact storage (14 bytes).&lt;/li&gt;
&lt;li&gt;Efficient indexing due to sequential nature.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TSIDs combine the benefits of integers, UUIDs, and ULIDs and are a recommended alternative for primary key values.  They borrow some structure from &lt;a href="https://en.wikipedia.org/wiki/Snowflake_ID"&gt;Snowflake IDs&lt;/a&gt; and Instagram IDs.&lt;/p&gt;

&lt;p&gt;One of the additional benefits are that we get automatic date timestamping that we can use for things like sorting and data analysis later on.  This can save us from adding an additional Date column in our schema for our database tables.  We get a timestamp, a node (shard) id, and a sequence number, all in one!  TSIDs come in handy when writing data about &lt;a href="https://www.wikidata.org/wiki/Q26907166"&gt;temporal entities&lt;/a&gt; or anything that is event-based, like comments, posts, transactions, etc.  But they can also be used as a primary key for non-temporal data in your tables.&lt;/p&gt;

&lt;p&gt;
  Click for structure of TSID
  &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;42-bit timestamp&lt;/strong&gt;: Calculated using milliseconds from a reference date (e.g., 2020-01-01).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;10-bit machine ID&lt;/strong&gt;: Unique identifier for the machine generating the TSID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;12-bit sequence number&lt;/strong&gt;: Ensures uniqueness within the same millisecond.
&lt;/li&gt;
&lt;/ul&gt;

 


&lt;/p&gt;
&lt;p&gt;When stored as a long TSIDs look like this:&lt;br&gt;
&lt;code&gt;38352658567418872&lt;/code&gt;&lt;br&gt;
And when written as Text or a String they look like this:&lt;br&gt;
&lt;code&gt;01226N0640J7Q&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Auto Generating TSIDs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt; can automatically generate TSID primary keys as it inserts data through its instant API into your database tables.  It does this by auto detecting an existing primary key column in the table you are writing to and will use the datatype category (Integer-based or Text/String based) to generate the appropriate TSID format (Long/Number or Text).&lt;/p&gt;

&lt;p&gt;Let's use a DB2Rest API endpoint to write to our &lt;code&gt;/actor/&lt;/code&gt; table with bulk data and let DB2Rest worry about automatically creating our tables' primary keys for each row inserted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REQUEST:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url http://localhost:8080/actor/bulk \
--header 'Content-Type: application/json'
--data '[
    {

        "first_name" : "Salman",
        "last_name" : "Khan"
    },
    {

        "first_name" : "Hrithik",
        "last_name" : "Roshan"
    },
    {

        "first_name" : "Tom",
        "last_name" : "Cruise"
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;RESULT:&lt;/strong&gt;&lt;br&gt;
Table: &lt;code&gt;actor&lt;/code&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;id&lt;/th&gt;
&lt;th&gt;first_name&lt;/th&gt;
&lt;th&gt;last_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0012&lt;/td&gt;
&lt;td&gt;John&lt;/td&gt;
&lt;td&gt;Travolta&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0036&lt;/td&gt;
&lt;td&gt;George&lt;/td&gt;
&lt;td&gt;Clooney&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01226N0640J7P&lt;/td&gt;
&lt;td&gt;Salman&lt;/td&gt;
&lt;td&gt;Khan&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01226N0640J7Q&lt;/td&gt;
&lt;td&gt;Hrithik&lt;/td&gt;
&lt;td&gt;Roshan&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01226N0640J7R&lt;/td&gt;
&lt;td&gt;Tom&lt;/td&gt;
&lt;td&gt;Cruise&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice that we had 2 existing rows in our &lt;code&gt;actor&lt;/code&gt; table with id's &lt;code&gt;0012&lt;/code&gt; and &lt;code&gt;0036&lt;/code&gt; with famous actor names?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt; detected the data type of our existing &lt;code&gt;id&lt;/code&gt; column and determined to use the String format for automatic TSID generation when writing the 3 new rows of data from our API POST request.  We didn't have to write any special application code ourselves to do this or even setup a database stored procedure!&lt;/p&gt;
&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;What's really amazing here is that DB2Rest automatically creates an API for our &lt;code&gt;actor&lt;/code&gt; table (securely and safely) for fast frontend application development.  We didn't have to code an API data access layer for our database tables at all!  DB2Rest does this for us without using an ORM (Object Relational Mapper) or using any code generation that slows things down!&lt;/p&gt;

&lt;p&gt;Read more about DB2Rest benefits in my previous post:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/thadguidry" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9JcyaciL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.dev.to/cdn-cgi/image/width%3D150%2Cheight%3D150%2Cfit%3Dcover%2Cgravity%3Dauto%2Cformat%3Dauto/https%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Fuser%252Fprofile_image%252F1417872%252Fc03092f5-99bd-4309-ac4c-4644fa5ed679.jpeg" alt="thadguidry"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/thadguidry/expose-your-database-as-a-rest-api-safely-and-without-code-5242" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Easy no-code REST API for your databases&lt;/h2&gt;
      &lt;h3&gt;Thad Guidry ・ Apr 11&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#restapi&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#sql&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#database&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#opensource&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;In summary, TSIDs strike a balance between integers and UUIDs, offering chronological sorting, compactness, and efficient indexing. If you plan to store UUID values in a primary key column, TSIDs are a recommended alternative.&lt;/p&gt;

&lt;p&gt;You can &lt;strong&gt;save 100's of hours of coding&lt;/strong&gt; data access layers by quickly enabling an &lt;strong&gt;instant API&lt;/strong&gt; for your database by using &lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt; , an APACHE 2 licensed open source middleware.&lt;/p&gt;

</description>
      <category>nocode</category>
      <category>restapi</category>
      <category>database</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Easy no-code REST API for your databases</title>
      <dc:creator>Thad Guidry</dc:creator>
      <pubDate>Thu, 11 Apr 2024 04:11:39 +0000</pubDate>
      <link>https://dev.to/thadguidry/expose-your-database-as-a-rest-api-safely-and-without-code-5242</link>
      <guid>https://dev.to/thadguidry/expose-your-database-as-a-rest-api-safely-and-without-code-5242</guid>
      <description>&lt;p&gt;One of the complex parts of application development is to first write code to connect to your database and trying to leverage an Object Relational Mapping (ORM) framework to help write your data access layer.&lt;/p&gt;

&lt;p&gt;But what would things look like if you didn't need an ORM? Or didn't need to write data access code to access your database? How would you then &lt;strong&gt;expose the data&lt;/strong&gt; AND &lt;strong&gt;access it safely&lt;/strong&gt; for your frontend application development?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/REST"&gt;REST API's&lt;/a&gt; provide a standardized interface to use HTTP requests to return data to users or applications in the form of JSON, HTML, XML, etc.&lt;/p&gt;

&lt;p&gt;We can use some &lt;a href="https://en.wikipedia.org/wiki/Middleware"&gt;middleware&lt;/a&gt; to sit between our database and our application.  We can then use RESTful queries in our application to ask the middleware to give us the specific data filtered to our liking as needed for our applications' operations.  But which middleware? And wouldn't something in the middle slow things down?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://db2rest.com"&gt;DB2Rest&lt;/a&gt; is &lt;strong&gt;open source&lt;/strong&gt; middleware that offers a no-code way to safely expose data from your database for your applications to consume.  It's runs as a service that you can host locally or in the cloud.  It even has an easy to use Docker deployment.&lt;/p&gt;

&lt;h1&gt;
  
  
  Simple
&lt;/h1&gt;

&lt;p&gt;Let's see a simple example of a query with DB2Rest that shows how to filter on our database table of &lt;code&gt;movies&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;QUERY:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http GET 'http://example.com/movies?filter=title=="Titanic";year=gt=1950' \
User-Agent:insomnia/8.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;RESULT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked

[
    {
        "title": "Titanic",
        "year": 1953,
        "distributor": "20th Century Fox",
        "budget": "$1,805,000",
        "director": "Jean Negulesco"

    },
    {
        "title": "Titanic",
        "year": 1997,
        "distributor": "Paramount Pictures",
        "budget": "$200,000,000",
        "director": "James Cameron"
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the QUERY where we didn't even need to use a full SQL query!?! We simply asked to filter the year greater than (&lt;code&gt;=gt=&lt;/code&gt;) &lt;code&gt;1950&lt;/code&gt; and it easily returned results!  DB2Rest uses simple syntax (based on RQL) for querying and even joining tables.&lt;/p&gt;

&lt;h1&gt;
  
  
  Fast
&lt;/h1&gt;

&lt;p&gt;DB2Rest is blazing fast even as middleware and &lt;a href="https://twitter.com/DB2Rest/status/1778205203587850289"&gt;reported by users&lt;/a&gt; since it doesn't need to use an ORM, but instead uses industry proven data access libraries and drivers for the most common databases.  The queries are even cached for greater speed.  DB2Rest translates your queries (without code generation!) into SQL so you don't have to, forwards to the database, and returns paginated results in JSON.  If you already know SQL, DB2Rest can also just forward any custom SQL expressions to your database.&lt;/p&gt;

&lt;p&gt;This is really great, because with DB2Rest you can even expose legacy databases to your applications without all the pain of coding, and quickly take advantage of that older data, or even skip database migrations and just use DB2Rest to give data access to your legacy data!&lt;/p&gt;

&lt;h1&gt;
  
  
  Secure
&lt;/h1&gt;

&lt;p&gt;What is even better, I think, is that DB2Rest can serve as a gateway of sorts by being middleware and not directly exposing your database to your application, but instead only the data it needs.  There's not even a possibility of SQL Injection attacks because of this.  Security concerns are further minimized by configuring DB2Rest to use a DB user account that only has access to the schema and tables you wish to give access to.  All data access security is thus handled directly by your database user access roles (and not DB2Rest) to conform with best practices and allow database administrators (&lt;a href="https://en.wikipedia.org/wiki/Database_administration"&gt;DBAs&lt;/a&gt;) to continue to maintain security access roles as they need, even in an enterprise setting.&lt;/p&gt;

&lt;p&gt;Visit &lt;a href="https://db2rest.com"&gt;DB2Rest.com&lt;/a&gt; to learn more and see all the databases it currently supports and other examples of advanced filtering, updating, deleting, and joining data from tables.&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>sql</category>
      <category>database</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
