Introduction
The schmuckliCloud Storage service was the first initial service from schmuckliCloud service. It is based on a MySQL database and will be used to store and load data objects.
Overview
If you have come in touch with a normal relational database, the entry in the schmuckliCloud database would be very easy. Although it uses different names and does have a special system with saving user data and does not use SQL as a language, all other features are similar to a normal database.
Example
In the following graph, you can see a basic example of the different components of the storage module. On the top, you have your project and a standard bucket with the ID 1
. Inside of this bucket, we have defined two containers, with each containing two columns. The containers also always have already an autoincrement ID implemented and are unique across the complete system.
As you can see, the data is now separated into datasets and rows. A dataset can contain multiple rows and one row does contain data for every column. We have created two rows inside the dataset ABC
in the container products
. And we have two other rows defined in the dataset DEF
.
If you fetch, insert, update or delete the data, you always have to define a dataset. Datasets do represent a type of view in your container. You can't view all the data from multiple datasets at once in a request. This also prevents that you can't access a product id, which is not in the same dataset. For example, a buyer from dataset ABC
cannot order a product with the row 3
(Pineapples), since it is in the other dataset DEF
.
Datasets are also active in the authentication module. The module uses it to give every user a separate space, where the same structure should exist, but the data should be different of course.
What are buckets?
You can compare buckets with databases in the schmuckliCloud console. If stores all your data for a specific part of your app. For example, if you want to save the user information like email or phone numbers apart of the actual user data, then you can simply split up the data. In the usual case, you only need one database per app, since you don't want to switch between the two buckets.
What are datasets?
A special feature of schmuckliCloud storage is the datasets. A dataset is actually a perspective of a container. If you want to list containers data, you always have to provide next the bucket id, a dataset name. This is useful if you want to store user data and don't want to create the container multiple times (like in NoSQL) or to create an extra column in your relational database to store the user id.
As an example, a dataset name can be a strongly hashed user id.
What are containers?
If you are familiar with tables, then containers do the same job. Containers are storing the columns which hold the actual data. You also can get the view of it like a simple JSON data object, which contains properties (column names) and their values. In the SDK's you always can change between the containers, so feel free to create as much container you would like.
For example, you can use containers to store the posts of a specific user.
What are columns?
Columns are like in SQL Databases the fields, where data can be stored. Each column should exist only once in a row. You can define also if the column should match a pattern. When data is updated in that column, it will always be verified, if it matches the pattern as well. If not, it will not save the sent data.
Datatypes
As in every major database query language, you are able to define a datatype for your fields. The architecture of schmuckliCloud allows a little bit more than that. It combines the data types and the input validation together. This is done with a pattern, which you can define per column (field). The column will check when inserting and updating the data if the user has provided the data in the correct format. If not, it will give you an error message, on which column the pattern matching not worked. When you try to sort and filter numbers, it will automatically convert the values defined.
Required columns
In addition to the pattern matching described above, you can also set the column to the state, that it always has to be filled with a value. Otherwise, it will not insert or update the values provided, not even the other in the same row.