To create an API key, go to the security tab on the left side of your screen.Ĭlick New Key to generate a key. The indexes should be created as seen below.īefore you can begin building a Django app that uses Fauna, you need to create an API key that will allow our Django app to easily interact with the database. We also have to create three indexes one with the date and time attributes as unique terms of the Events collection, the other with user attribute as terms, and the last with user and date as terms. Click on save once you are done filling the required fields. In this case, we are using a username as the terms. The terms field is used to specify what data you want the index to be able to browse. Also tick the Unique checkbox to ensure the data entered for the username is unique. After choosing the collection, enter a name for your index, terms for your index, and values. You are required to select the collection you want to connect this particular index to. To do this, go to the DB Overview tab on the left side of your screen then click on the New Index button.Īfter clicking on the New Index button you will be presented with the above screen. We will need to create a Fauna index that allows us to scroll through data added to our database. A document is relatable to rows of data in a table like a normal database system. For example, if the TTL is set to 5, any data stored in the collection will automatically be deleted 5 days after its last modified date.Īfter saving the collection you just created, you will be presented with a screen similar to the image above. The History Days is the number of days you want Fauna to retain a historical record of any data in that collection while the TTL is an expiry date for data in the collection. You will need to enter the name for the collection, the History Days and TTL. Click on CREATE COLLECTION then fill in the required fields. A collection could be thought of as a table in a database system. You will also need to create two collections (one for users and one for events). After signing up, you can now create a new database by clicking on the CREATE DATABASE button on the dashboard.Īfter clicking on the button as shown in the image above, you then need to give your database a name and save it. To create a Fauna database, you have to first sign up for an account. You can learn more about Fauna in their official documentation here. Django is a very popular web framework, but not so many people know about Fauna and how amazing it can be when managing databases.įauna is a client-side serverless document database that makes use of GraphQL and the Fauna Query Language (FQL) to support a variety of data types and particularly relational databases in a serverless API. To build this, I made use of the Django Python web framework and Fauna. I decided to build a solution to this problem, with the appointment scheduling application I can easily check appointments I have for the day. Personally, I have always had problems with remembering meetings and appointments I have planned out for the day. If you have ever wanted to build an appointment scheduling application with Django and have been looking to explore Fauna serverless database then this article is for you.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |