April 21, 2023

Introducing Kuneiform: A Language and IDE for Permissionless Databases

Luke Lamey

Today, we are excited to unveil our next major release to Kwil: The Kuneiform Release. This release is a significant update to supporting permissionless and decentralized SQL databases for the Web3-development stack.

Kuneiform is an easy-to-use syntax language for deploying permissionless relational databases. With the release of the Kuneiform language, we are also excited to release the Kuneiform IDE: a browser-based IDE that allows developers to write, compile, and deploy permissionless SQL databases on Kwil. The Kuneiform IDE draws heavily from Ethereum’s remix IDE. Alongside this release, we are also launching new Javascript/Typescript and Python SDKs for interacting with the Kwil network.

Kuneiform also allows Kwil to support most of the SQL-92 standard. Previously, Kwil only supported basic Insert/Update/Delete operations. With Kwil, you can now execute subqueries, joins, and ad-hoc select statements on databases. This is a massive upgrade for using permissionless databases across large and complex datasets.

Full documentation on Kuneiform can be found here. You can start deploying today (with example databases) at https://ide.kwil.com/.

Getting Started With Kuneiform

Before starting with Kuneiform, ensure you have some Kwil testnet tokens. Then, head over to https://ide.kwil.com/.

First, connect your MetaMask wallet and add your tokens to the funding pool. Funds must be approved before they can be deposited. Depositing must wait for 12 block confirmations — so do not be alarmed if it takes a few minutes. You can proceed to do other things in the application while the funding is confirmed.

Adding Tokens to Funding Pool

Next, begin writing in “index.kf”. We can start by declaring the database name and defining the table structures.

Sample Database and Table Declaration

Below the tables, you can define actions. Actions are predefined SQL queries that are called once the database is deployed. Actions are similar to smart contract functions — anyone that confirms to the rules of the action can execute the action. You can set actions as public (anyone can execute) or private (only the deploying wallet can execute). More on actions, their syntax, and how to manage access control can be found in the docs.

Action Declarations

Once the database is ready, you can toggle to the submit tab (third button on the navigation bar), select the file you want to deploy, compile the file, and then click submit. Remember, you must connect your wallet, and you must have funds in the funding pool before you can deploy your database!

Database is ready to be deployed!

On the last tab, you can select and interact with your deployed databases. This allows you to test the functionality of your database and verify that it behaves as expected. Actions executed in this tab are live and reflected in your database.

Testing the database

New Javascript/Typescript SDK, Python SDK, and CLI

With this release, we are also thrilled to launch a revamped JS/TS SDK, a brand new Python SDK, and an upgraded CLI.

The new JS/TS SDK mirrors much of the same behavior as the previous release. Developers will find that the processes for retrieving their schema, listing their database, and adding funds are nearly the same as before. New to this SDK is the ability to call and execute actions (i.e., predefined SQL queries), deploy compiled Kuneiform (which can be exported from the IDE), and execute SELECT queries against public databases. We have also deprecated the DBBuilder class in favor of developers now deploying their databases with Kuneiform. Full documentation on the JS/TS SDK can be found here.

The Python SDK opens a new avenue for developers to interact with Kwil. After our previous release, we found that many data-intensive applications (e.g., data providers, AI, etc.) are built in Python environments. We believe that allowing developers to use Kwil with Python will expand the use cases and audience for permissionless relational databases. The Python SDK contains many similar functionalities as the JS/TS SDK, including the ability to deploy databases, execute actions, and query new databases. Full documentation on the Kwil Python SDK can be found here.

The upgraded CLI now gives developers expanded functionality to interact with their Kwil databases. With this new version, developers and data teams can batch-insert data into their Kwil databases directly from a CSV. In our pre-launch testing, it took only a few seconds on average to insert over 100,000 records into a database. This functionality will allow developers and data teams to quickly and easily migrate their databases to Kwil, requiring little to no changes to their existing schemas.

Next Steps

Following this release, we are excited to continue iterating based on the feedback from our current and future partners. Many thanks to our existing design partners for their help and support in guiding this release’s strategy and development.

Next week, we are excited to co-host Permapalooza, a Consensus 2023 ancillary event with AR.IO. At the event, we will talk more about the technology and vision behind the Kuneiform language, as well as where we plan to grow from here. Permapalooza is a must-attend event for anyone interested in the Permaweb, Web 3.0, and the future of decentralized infrastructure as a whole.

Link to register: https://www.eventbrite.com/e/permapalooza-2023-tickets-609774531037?aff=ebdssbeac