Message:

Subscribe rss
Blog categories
All | Backendless features
Feature 13: Create data tables, columns and relations by importing CSV files
January 19, 2015 by markpiller
Spread the love

Backendless can create tables when you store object hierarchies from a client application. Also, I described how to manually create data tables using Backendless console. Finally, there is one more approach which makes table creation as simple as it gets. The approach is by uploading a file which contains schema definition for every table. The schema definition may include data types for all columns, including the ones for relations. As a part of my quest to build a restaurant to-go order app, I created all the tables in my Backendless backend. I used the schema export feature (to be discussed in the future) which generated for me a ZIP file with the schema definitions for all the tables used by the app. The ZIP archive includes a CSV file for every table: export zip contents - Feature 13: Create data tables, columns and relations by importing CSV files

The structure of each CSV file is rather simple. In this case it contains just the names of the columns and the corresponding data types. Additionally, they may contain data objects too, but that will be described in a separate post. For example, the following are the contents of Location.csv: location csv contents - Feature 13: Create data tables, columns and relations by importing CSV files and Restaurant.csv: restaurant csv contents - Feature 13: Create data tables, columns and relations by importing CSV files As you can see, every column definition in the files contains column name and the corresponding data type. Using this approach one can create all the tables, with columns and relations. The Backendless documentation describes the import file formatfor defining column names and their types. Please follow the instructions below to import the file and create all the tables for the Restaurant app in your backend:

  1. Download the ZIP file which contains the definition for all tables from: https://backendless.com/documentation/samples/restaurant-app-schema.zip
  2. Login to console, select an app (it is recommended to create a new app for this) and click the Manage icon.
  3. Select the Import menu item.
  4. Click the single Zip file link located in the description text and browse to the ZIP file from step 1 above. select zip file - Feature 13: Create data tables, columns and relations by importing CSV files
  5. Once the file is selected, Backendless immediately starts processing it and creating data tables. As soon as the process is finished, an email is delivered to the application developer with the status of the import. The email for the restaurant-app-schema.zip file should contain the following status:
  6. To confirm that all the tables, columns and relations have been created, click the Data icon. You should see the following tables in the list: tables after import - Feature 13: Create data tables, columns and relations by importing CSV files
Share this post
Tweet about this on TwitterShare on FacebookGoogle+