How to Publish a Database
In this article, I’m going to detail how you can create, import data and publish a database on Database HUB.
There are no prerequisites required to Publish the Data you want. If you have scrapped or exported this data from another source the only recommendation is to convert those data into CSV format.
1-Create a Database
The first step is very simple. Go to the Database HUB and click on the top-right button +Database.
Then you’ll see a modal window showing the process to create and Publish your Database:
1-Create your Account (FREE, no credit card required)
2-Populate your Database
3-Publish the Database on the HUB
Click over get started and go to Create account modal window. If you don’t have an account just click over – Don’t have an account? Sign up. – option.
On create account modal enter your email and a password (it’s not necessary to confirm the password).
Choose a Database name. In this case, I’m going to Publish a List of Game of Thrones characters.
NOTE: When creating a DB name is to understand that this is part of the URL so as much clear you can be when giving it a name as easier people will find your database when looking on search engines.Back4App Team
You’ll see a success window showing that your DB was created. Let’s go to the main Dashboard where the magic happens.
On the Dashboard, you’ll see the vertical-menus on the left side with the CORE main menu option opened. This menu is related to your Database. Each option gives you new possibilities to improve your Database.
- Dabatase Browser – You can create your Database Model and populate your classes (manually, via API or importing your CSV);
- Connections – You can connect other Public Databases to your Database;
- Index Manager – You can manage all the Automatic and non-automatic indexes created to improve your Database Performance.
- Cloud Code Functions – You can create functions in NodeJS to run using your Data;
- WebHooks – You can write external functions(in any technology) and use it on your Cloud Code Functions;
- Jobs- You can schedule Cloud Functions to run with a given frequency, like a Chron-Job;
- Logs – You will see all the Logs of your Database;
- Config – You can add some fixed-parameters to use on your functions;
- API Console – You can use that to test the Automatic APIs that the HUB generated to you in GraphQL and REST.
In this article, we’re going to show how to populate your Database only via CSV Import. If you would like to know more details about how to populate using the API or by exporting directly from other Database please leave a message on the comments.Back4App Team
Getting back to the Dashboard. Under the Database Browser sub-menu, you’ll see two default classes created just by convenience. At this moment you don’t need to worry about them.
Let’s create our Character’s class. Click over the Create Class button and then fill the information needed to create a basic class. Just select the option Custom(to create a custom class) and give it a name, in this case, we’re going to use the name character. Go ahead and click over Create Class Button.
NOTE: It is very recommended to create a class using just one name and using always the singular form.Back4App Team
As I’ve said you have the option to create the Class manually by adding columns and also populate using the adding rows button.
We’re going to use the Import file button. Let’s use this option today.
Before to click it is very important to make sure that your CSV File complies with the rules to be imported correctly. If you have scrapped the Data or exported from other sources(Databases, APIs, CSV Directories) make sure that they follow the rules:
Correct format parameters:
- Separation character must be a comma
,and NOT a semicolon
- Adjust your Spreadsheet software to output commas as separation characters
- First-line should be the Column Names
- The Importer will automatically convert Strings, Numbers, GeoPoints, and Booleans
- Dates must have two columns:
date.__typespecifies the Date type
date.isospecifies the Date Format
- GeoPoints must have three columns:
columnName.__typespecifies the Geopoint type
columnName.latitudespecifies the Latitude
columnName.longitudespecifies the Longitude
- Arrays are passed in double quotes
For more details about the rules, please check this Guide.
A very good approach can be to build your table using the Google Sheets and then use the export CSV Option. Google Sheets already export following some of those rules I’ve mentioned above.Back4App Team
I’ve also prepared some CSV examples if you want to check:
I’ve extracted a sample list from Wikipedia just to illustrate the process.
Then I used the export CSV function from Google Sheets.
This is the file generated by Sheets. We’re going to use it on Import a file option.
Now let’s make the magic happen. Click over Import a File and then select the CSV. Click over the Upload a file and select your CSV.
After selecting the file the button import will turn to blue. Just click over it and wait for the import process. After the modal closes, refresh your browser page.
It’s important to note that sometimes when the file is large this modal window won’t close. Do not click twice on Import button to avoid duplicated content on your Class.Back4App Team
Now you have your Class created and populated on Back4App. Let’s share this Data with the HUB community
2-Publish your Database
Under the Dashboard Vertical menu, you’ll see the option Publish on HUB. Click over it and then click over Publish on HUB button.
You have to accept the Terms of Publishing and then click over Publish.
Success! Your Database is now Public. You’ll see the Database URL that is automatically generated. Click over it and check your New Public Database on the HUB.
The Database page will be like this image below.
It is a very simple and clean page. Now let’s check how to make this page more detailed to your users to Connect on your new Public DB.
3-Customize your Public Database Page
To start customizing your DB Page click over the Edit button on the top-left.
You can change the Database Name, add a detailed description and add some tag to make easier for someone found your DB on HUB’s search. After edit click on Save button.
After that, you can edit the classes. Add a description to each Class and chose which classes you want to show. In this case, I’m excluding Role and User’s Classes because I’m not using it on my DB. Click Save.
On Notes field you can add Images, HTML code and also simple text to detail your Database even more. Take a look at the World, Continents and Cities Database Notes.
4-Customize a Public Class Page
On each class page of your Public Database, you can do the same procedure you’ve made to the main Database page.
The options to customize the Class Page are:
- How many records you want to show per page;
- Key Field;
You can also add notes in the same way you’ve done to Database main page.
This is what I have to show you today, do you have questions, comments, suggestions? Please email us at [email protected]