If you call yourself a builder, whether that means working on a startup, open source, or personal projects, you need to keep up to date with the latest tech. Innovation in software development is only accelerating, with paradigm shifts happening more and more often.
In the world of Databases, Fauna has generated a lot of buzz by creating one of the most versatile, scalable, and intuitive database technologies out there.
Today, we’ll explore how Fauna works and create and use our first Fauna database.
What is Fauna?
Fauna is a serverless, multi-region database that is accessible through a cloud API. That means that Creating, Reading, Updating and Deleting data can all be done within a standard api call.
For the more technically minded, Fauna is what’s called a transactional database. In layman’s terms, this means that you can get the flexibility of a noSQL database like Mongo, without sacrificing the speed and accuracy you get from a SQL Database.
This makes Fauna an amazing option for startups and personal projects that want to build quickly without incurring a ton of technical debt.
Creating a Fauna Account
To get started, first visit the signup page and create a free fauna account. This will direct the user to the fauna dashboard.
Click on CREATE DATABASE to create a database. Next, provide the database name and the region where the database will be created.
We will need the access key to interact with the database. Navigate to the security section from the database view. Here, you can create the access key that will be used to communicate with the Fauna API.
Integrating Fauna with an Application
Now that we have created a Fauna database and obtained the access key, we can utilize Fauna in an application. In this section, we will look at how we can communicate with Fauna using Python. Of course, since this is all API based, implementations will be nearly identical in every language.
Let’s first setup a python environment with:
pipenv shell
Now let’s install the dependencies. This is the Python driver for Fauna.
Pipenv install faunadb
Create the Application
In the following code, we connect to our database and perform all four CRUD operations that we expect from a database:
- Create
- Read
- Update
- Delete
If the program is successfully executed, you should see the following output for each respective function:
There you have it! We’ve setup our own Fauna project and performed all the standard database technologies in less than 100 lines of code. The simplicity of this implementation isn’t a result of us cutting corners – it’s actually that easy!
So what do you think? Are you going to be using Fauna for your next project? Let us know down below!
Happy coding from your good friends at Codesphere, the Swiss army knife every software developer needs.
Top comments (7)
I think closed source can never be a big thing.
I don't know that I agree.
Don't get me wrong -- the things open source has been capable of is mind-blowing, but that doesn't mean its the only way great software can be built.
The effectiveness of a small, cohesive team shouldn't be overlooked just because that team has direct profit incentives. Does open-source help create a built-in community for software? Of course. But that doesn't mean closed-source teams can't build good communities, it just means they have to be a bit more intentional, which isn't necessarily a bad thing for these communities.
Thoughts?
From what I have heard, closed source can be considered a liability when selling database software because clients will be wary of the company folding or the product being neglected when sales slow down. Of course, in the past, closed source database systems have done well.
Can the underlying database still decide over success or failure of your app? Don't get me wrong, I appreciate the hard work of FaunaDB's developers very much and scalability is a big thing when you address users worldwide. But the products that resulted from the NoSQL movement in combination with traditional databases already allow optimising your app's architecture for worldwide consumption, so even if FaunaDB was perfect it pushes the previous possibilities only a little notch up. I don't believe this is enough to become "the next big thing".
It's neat but when I tried it in 2020, latency was pretty high. Of course for a globally distributed serverless database that's to be expected but just something to keep in mind, as you'll want to be more strategic with database calls more than ever.
Isn' the model closed source ? and cannot be scaled by individual user rather than commercial by themselves only so perhaps it's a no.Although great software can be made in both closed and open source
ew bro who uses python for web🤢