Open a Realm File¶
On this page
If you have a local realm file that you've created by running a client application, you can open it in Realm Studio.
If you don't already have a realm file, you can create one by importing a CSV, or you can download a demo file.
Open a Local Realm File¶
You can use Realm Studio to open and explore a local realm file. This could be a file generated from running an emulator on your local machine, or a file from another source. Some development tools even allow you to view and edit the realm file while the emulator is running. This workflow supports fast, simple iteration for changes to objects and schemas.
Find a Realm File¶
Realm Database stores a binary-encoded version of every object and type in a single realm file. The file is located at a specific path that you define when you open the realm.
To find your default realm file path:
Once you know the location of your local realm file, you can browse to that location from the Open Realm file dialog.
On MacOS, the default location for Xcode emulator files is under the
~/Library folder. By default, this is a hidden directory. You may
not be able to browse to this location from the Open Realm
Use another technique to view the file, such as
Go to Folder in
Finder, and open the realm from there.
Create from a CSV¶
If you don't have a local realm file, you can create one from a CSV in Realm Studio.
When you create a realm from CSV, Realm Studio infers these details:
- The name of your CSV becomes the class name in the realm file
- The first row of your CSV becomes the class property names in the realm
- The values of each column shape the class property types. A column of 'true' and 'false' values becomes a boolean property type. A column of whole numbers becomes an integer property type, and so on. If Realm Studio can't determine the property type, it becomes a string.
For example, a CSV named
data.csv with this formatting:
1 device,number,flag 2 gizmo,1,TRUE 3 widget,2,FALSE
Becomes a class model named
data that has three properties:
device, with a type
number, with a type
flag, with a type
Browse to the Create Realm from CSV option¶
In Realm Studio, go to: File > Create Realm from > CSV
Open your CSV¶
Browse to the location of your CSV file, and select it.
Press the Open button.
Choose where to store the imported data¶
Enter a name for the realm file that will be created from your CSV.
Browse to the location where you want to save it.
Press the Save button.
Add more data to the realm¶
When you create a new realm file from a CSV, you may get this message:
"Failed to import data: Class name (name-of-file.csv) missing from schema"
If this happens, press OK. You'll see that creating a realm from your CSV has created a class definition, but there are no objects in your realm. From here, you can Import from a CSV to populate your realm with object that map to the class definition you just created.
Download an Example¶
If you're new to Realm Database and don't have a realm file or CSV to import, you can still try out Realm Studio.
When you open Realm Studio, you'll see an option to Download a demo Realm file.
When you click the link to download the demo file in Realm Studio, you can specify a name and location to save a realm file containing demo data. Once you have downloaded the file, you can use the Open Realm file dialog to open it.