Export Format

When you run the EXPORT DATABASE command, OrientDB exports the database into a zipped file using a special JSON format. When you run the IMPORT DATABASE command, OrientDB unzips the file and parses the JSON, making the import.

Sections

Export files for OrientDB use the following sections. Note that while the export format is 100% JSON, there are some constraints in the format, where the field order must be kept. Additionally, modifying the file to adjust the indentation (as has been done in the examples below), may make it unusable in database imports.

Info Section

The first section contains the resuming database information as well as all versions used during the export. OrientDB uses this information to check for compatibility during the import.

  1. "info": {
  2. "name": "demo",
  3. "default-cluster-id": 2,
  4. "exporter-format": 2,
  5. "engine-version": "1.7-SNAPSHOT",
  6. "storage-config-version": 2,
  7. "schema-version": 4,
  8. "mvrbtree-version": 0
  9. }
Parameter Description JSON Type
"name" Defines the name of the database. String
"default-cluster-id" Defines the Cluster ID to use by default. Range: 0-32,762. Integer
"exporter-format" Defines the version of the database exporter. Integer
"engine-version" Defines the version of OrientDB. String
"storage-version" Defines the version of the Storage layer. Integer
"schema-version" Defines the version of the schema exporter. Integer
"mvrbtree-version" Defines the version of the MVRB-Tree. Integer

Clusters Section

This section defines the database structure in clusters. It is formed from a list with an entry for each cluster in the database.

  1. "clusters": [
  2. {"name": "internal", "id": 0, "type": "PHYSICAL"},
  3. {"name": "index", "id": 1, "type": "PHYSICAL"},
  4. {"name": "default", "id": 2, "type": "PHYSICAL"}
  5. ]
Parameter Description JSON Type
"name" Defines the logical name of the cluster. String
"id" Defines the Cluster ID. Range: 0-32, 767. Integer
"type" Defines the cluster type: PHYSICAL, LOGICAL and MEMORY. String

Schema Section

This section defines the database schema as classes and properties.

  1. "schema":{
  2. "version": 210,
  3. "classes": [
  4. {"name": "Account", "default-cluster-id": 9, "cluster-ids": [9],
  5. "properties": [
  6. {"name": "binary", "type": "BINARY", "mandatory": false, "not-null": false},
  7. {"name": "birthDate", "type": "DATE", "mandatory": false, "not-null": false},
  8. {"name": "id", "type": "INTEGER", "mandatory": false, "not-null": false}
  9. ]
  10. }
  11. ]
  12. }
Parameter Description JSON Type
"version" Defines the version of the record storing the schema. Range: 0-2,147,483,647. Integer
"classes" Defines a list of entries for each class in the schema. Array

Parameters for the Classes Subsection:

Parameter Description JSON Type
"name" Defines the logical name of the class. String
"default-cluster-id" Defines the default Cluster ID for the class. It represents the cluster that stores the class records. Integer
"cluster-ids" Defines an array of Cluster ID’s that store the class records. The first ID is always the default Cluster ID. Array of Integers
"properties" Defines a list of entries for each property for the class in the schema. Array

Parameters for the Properties Sub-subsection:

Parameter Description JSON Type
"name" Defines the logical name of the property. String
"type" Defines the property type. String
"mandatory" Defines whether the property is mandatory. Boolean
"not-null" Defines whether the property accepts a NULL value. Boolean

Records Section

This section defines the exported record with metadata and fields. Entries for metadata are distinguished from fields by the @ symbol.

  1. "records": [
  2. {"@type": "d", "@rid": "#12:476", "@version": 0, "@class": "Account",
  3. "account_id": 476,
  4. "date": "2011-12-09 00:00:00:0000",
  5. "@fieldTypes": ["account_id=i", "date=t"]
  6. },
  7. {"@type": "d", "@rid": "#12:477", "@version": 0, "@class": "Whiz",
  8. "id": 477,
  9. "date": "2011-12-09 00:00:00:000",
  10. "text": "He in office return He inside electronics for $500,000 Jay",
  11. "@fieldTypes": "date=t"
  12. }
  13. ]

Parameters for Metadata

Parameter Description JSON Type
"@type" Defines the record-type: d for Document, b for Binary. String
"@rid" Defines the Record ID, using the format: <cluster-id>:<cluster-position>. String
"@version" Defines the record version. Range: 0-2, 147, 483, 647. Integer
"@class" Defines the logical class name for the record. String
"@fieldTypes" Defines an array of the types for each field in this record. Any

Supported Field Types

Value Type
l Long
f Float
d Double
s Short
t Datetime
d Date
c Decimal
b Byte

Full Example

  1. {
  2. "info":{
  3. "name": "demo",
  4. "default-cluster-id": 2,
  5. "exporter-version": 2,
  6. "engine-version": "1.0rc8-SNAPSHOT",
  7. "storage-config-version": 2,
  8. "schema-version": 4,
  9. "mvrbtree-version": 0
  10. },
  11. "clusters": [
  12. {"name": "internal", "id": 0, "type": "PHYSICAL"},
  13. {"name": "index", "id": 1, "type": "PHYSICAL"},
  14. {"name": "default", "id": 2, "type": "PHYSICAL"},
  15. {"name": "orole", "id": 3, "type": "PHYSICAL"},
  16. {"name": "ouser", "id": 4, "type": "PHYSICAL"},
  17. {"name": "orids", "id": 5, "type": "PHYSICAL"},
  18. {"name": "csv", "id": 6, "type": "PHYSICAL"},
  19. {"name": "binary", "id": 8, "type": "PHYSICAL"},
  20. {"name": "account", "id": 9, "type": "PHYSICAL"},
  21. {"name": "company", "id": 10, "type": "PHYSICAL"},
  22. {"name": "profile", "id": 11, "type": "PHYSICAL"},
  23. {"name": "whiz", "id": 12, "type": "PHYSICAL"},
  24. {"name": "address", "id": 13, "type": "PHYSICAL"},
  25. {"name": "city", "id": 14, "type": "PHYSICAL"},
  26. {"name": "country", "id": 15, "type": "PHYSICAL"},
  27. {"name": "dummy", "id": 16, "type": "PHYSICAL"},
  28. {"name": "ographvertex", "id": 26, "type": "PHYSICAL"},
  29. {"name": "ographedge", "id": 27, "type": "PHYSICAL"},
  30. {"name": "graphvehicle", "id": 28, "type": "PHYSICAL"},
  31. {"name": "graphcar", "id": 29, "type": "PHYSICAL"},
  32. {"name": "graphmotocycle", "id": 30, "type": "PHYSICAL"},
  33. {"name": "newv", "id": 31, "type": "PHYSICAL"},
  34. {"name": "mappoint", "id": 33, "type": "PHYSICAL"},
  35. {"name": "person", "id": 35, "type": "PHYSICAL"},
  36. {"name": "order", "id": 36, "type": "PHYSICAL"},
  37. {"name": "post", "id": 37, "type": "PHYSICAL"},
  38. {"name": "comment", "id": 38, "type": "PHYSICAL"}
  39. ],
  40. "schema":{
  41. "version": 210,
  42. "classes": [
  43. {"name": "Account", "default-cluster-id": 9, "cluster-ids": [9],
  44. "properties": [
  45. {"name": "binary", "type": "BINARY", "mandatory": false, "not-null": false},
  46. {"name": "birthDate", "type": "DATE", "mandatory": false, "not-null": false},
  47. {"name": "id", "type": "INTEGER", "mandatory": false, "not-null": false}
  48. ]
  49. },
  50. {"name": "Address", "default-cluster-id": 13, "cluster-ids": [13]
  51. },
  52. {"name": "Animal", "default-cluster-id": 17, "cluster-ids": [17]
  53. },
  54. {"name": "AnimalRace", "default-cluster-id": 18, "cluster-ids": [18]
  55. },
  56. {"name": "COMMENT", "default-cluster-id": 38, "cluster-ids": [38]
  57. },
  58. {"name": "City", "default-cluster-id": 14, "cluster-ids": [14]
  59. },
  60. {"name": "Company", "default-cluster-id": 10, "cluster-ids": [10], "super-class": "Account",
  61. "properties": [
  62. ]
  63. },
  64. {"name": "Country", "default-cluster-id": 15, "cluster-ids": [15]
  65. },
  66. {"name": "Dummy", "default-cluster-id": 16, "cluster-ids": [16]
  67. },
  68. {"name": "GraphCar", "default-cluster-id": 29, "cluster-ids": [29], "super-class": "GraphVehicle",
  69. "properties": [
  70. ]
  71. },
  72. {"name": "GraphMotocycle", "default-cluster-id": 30, "cluster-ids": [30], "super-class": "GraphVehicle",
  73. "properties": [
  74. ]
  75. },
  76. {"name": "GraphVehicle", "default-cluster-id": 28, "cluster-ids": [28], "super-class": "OGraphVertex",
  77. "properties": [
  78. ]
  79. },
  80. {"name": "MapPoint", "default-cluster-id": 33, "cluster-ids": [33],
  81. "properties": [
  82. {"name": "x", "type": "DOUBLE", "mandatory": false, "not-null": false},
  83. {"name": "y", "type": "DOUBLE", "mandatory": false, "not-null": false}
  84. ]
  85. },
  86. {"name": "OGraphEdge", "default-cluster-id": 27, "cluster-ids": [27], "short-name": "E",
  87. "properties": [
  88. {"name": "in", "type": "LINK", "mandatory": false, "not-null": false, "linked-class": "OGraphVertex"},
  89. {"name": "out", "type": "LINK", "mandatory": false, "not-null": false, "linked-class": "OGraphVertex"}
  90. ]
  91. },
  92. {"name": "OGraphVertex", "default-cluster-id": 26, "cluster-ids": [26], "short-name": "V",
  93. "properties": [
  94. {"name": "in", "type": "LINKSET", "mandatory": false, "not-null": false, "linked-class": "OGraphEdge"},
  95. {"name": "out", "type": "LINKSET", "mandatory": false, "not-null": false, "linked-class": "OGraphEdge"}
  96. ]
  97. },
  98. {"name": "ORIDs", "default-cluster-id": 5, "cluster-ids": [5]
  99. },
  100. {"name": "ORole", "default-cluster-id": 3, "cluster-ids": [3],
  101. "properties": [
  102. {"name": "mode", "type": "BYTE", "mandatory": false, "not-null": false},
  103. {"name": "name", "type": "STRING", "mandatory": true, "not-null": true},
  104. {"name": "rules", "type": "EMBEDDEDMAP", "mandatory": false, "not-null": false, "linked-type": "BYTE"}
  105. ]
  106. },
  107. {"name": "OUser", "default-cluster-id": 4, "cluster-ids": [4],
  108. "properties": [
  109. {"name": "name", "type": "STRING", "mandatory": true, "not-null": true},
  110. {"name": "password", "type": "STRING", "mandatory": true, "not-null": true},
  111. {"name": "roles", "type": "LINKSET", "mandatory": false, "not-null": false, "linked-class": "ORole"}
  112. ]
  113. },
  114. {"name": "Order", "default-cluster-id": 36, "cluster-ids": [36]
  115. },
  116. {"name": "POST", "default-cluster-id": 37, "cluster-ids": [37],
  117. "properties": [
  118. {"name": "comments", "type": "LINKSET", "mandatory": false, "not-null": false, "linked-class": "COMMENT"}
  119. ]
  120. },
  121. {"name": "Person", "default-cluster-id": 35, "cluster-ids": [35]
  122. },
  123. {"name": "Person2", "default-cluster-id": 22, "cluster-ids": [22],
  124. "properties": [
  125. {"name": "age", "type": "INTEGER", "mandatory": false, "not-null": false},
  126. {"name": "firstName", "type": "STRING", "mandatory": false, "not-null": false},
  127. {"name": "lastName", "type": "STRING", "mandatory": false, "not-null": false}
  128. ]
  129. },
  130. {"name": "Profile", "default-cluster-id": 11, "cluster-ids": [11],
  131. "properties": [
  132. {"name": "hash", "type": "LONG", "mandatory": false, "not-null": false},
  133. {"name": "lastAccessOn", "type": "DATETIME", "mandatory": false, "not-null": false, "min": "2010-01-01 00:00:00"},
  134. {"name": "name", "type": "STRING", "mandatory": false, "not-null": false, "min": "3", "max": "30"},
  135. {"name": "nick", "type": "STRING", "mandatory": false, "not-null": false, "min": "3", "max": "30"},
  136. {"name": "photo", "type": "TRANSIENT", "mandatory": false, "not-null": false},
  137. {"name": "registeredOn", "type": "DATETIME", "mandatory": false, "not-null": false, "min": "2010-01-01 00:00:00"},
  138. {"name": "surname", "type": "STRING", "mandatory": false, "not-null": false, "min": "3", "max": "30"}
  139. ]
  140. },
  141. {"name": "PropertyIndexTestClass", "default-cluster-id": 21, "cluster-ids": [21],
  142. "properties": [
  143. {"name": "prop1", "type": "STRING", "mandatory": false, "not-null": false},
  144. {"name": "prop2", "type": "INTEGER", "mandatory": false, "not-null": false},
  145. {"name": "prop3", "type": "BOOLEAN", "mandatory": false, "not-null": false},
  146. {"name": "prop4", "type": "INTEGER", "mandatory": false, "not-null": false},
  147. {"name": "prop5", "type": "STRING", "mandatory": false, "not-null": false}
  148. ]
  149. },
  150. {"name": "SQLDropIndexTestClass", "default-cluster-id": 23, "cluster-ids": [23],
  151. "properties": [
  152. {"name": "prop1", "type": "DOUBLE", "mandatory": false, "not-null": false},
  153. {"name": "prop2", "type": "INTEGER", "mandatory": false, "not-null": false}
  154. ]
  155. },
  156. {"name": "SQLSelectCompositeIndexDirectSearchTestClass", "default-cluster-id": 24, "cluster-ids": [24],
  157. "properties": [
  158. {"name": "prop1", "type": "INTEGER", "mandatory": false, "not-null": false},
  159. {"name": "prop2", "type": "INTEGER", "mandatory": false, "not-null": false}
  160. ]
  161. },
  162. {"name": "TestClass", "default-cluster-id": 19, "cluster-ids": [19],
  163. "properties": [
  164. {"name": "name", "type": "STRING", "mandatory": false, "not-null": false},
  165. {"name": "testLink", "type": "LINK", "mandatory": false, "not-null": false, "linked-class": "TestLinkClass"}
  166. ]
  167. },
  168. {"name": "TestLinkClass", "default-cluster-id": 20, "cluster-ids": [20],
  169. "properties": [
  170. {"name": "testBoolean", "type": "BOOLEAN", "mandatory": false, "not-null": false},
  171. {"name": "testString", "type": "STRING", "mandatory": false, "not-null": false}
  172. ]
  173. },
  174. {"name": "Whiz", "default-cluster-id": 12, "cluster-ids": [12],
  175. "properties": [
  176. {"name": "account", "type": "LINK", "mandatory": false, "not-null": false, "linked-class": "Account"},
  177. {"name": "date", "type": "DATE", "mandatory": false, "not-null": false, "min": "2010-01-01"},
  178. {"name": "id", "type": "INTEGER", "mandatory": false, "not-null": false},
  179. {"name": "replyTo", "type": "LINK", "mandatory": false, "not-null": false, "linked-class": "Account"},
  180. {"name": "text", "type": "STRING", "mandatory": true, "not-null": false, "min": "1", "max": "140"}
  181. ]
  182. },
  183. {"name": "classclassIndexManagerTestClassTwo", "default-cluster-id": 25, "cluster-ids": [25]
  184. },
  185. {"name": "newV", "default-cluster-id": 31, "cluster-ids": [31], "super-class": "OGraphVertex",
  186. "properties": [
  187. {"name": "f_int", "type": "INTEGER", "mandatory": false, "not-null": false}
  188. ]
  189. },
  190. {"name": "vertexA", "default-cluster-id": 32, "cluster-ids": [32], "super-class": "OGraphVertex",
  191. "properties": [
  192. {"name": "name", "type": "STRING", "mandatory": false, "not-null": false}
  193. ]
  194. },
  195. {"name": "vertexB", "default-cluster-id": 34, "cluster-ids": [34], "super-class": "OGraphVertex",
  196. "properties": [
  197. {"name": "map", "type": "EMBEDDEDMAP", "mandatory": false, "not-null": false},
  198. {"name": "name", "type": "STRING", "mandatory": false, "not-null": false}
  199. ]
  200. }
  201. ]
  202. },
  203. "records": [{
  204. "@type": "d", "@rid": "#12:476", "@version": 0, "@class": "Whiz",
  205. "id": 476,
  206. "date": "2011-12-09 00:00:00:000",
  207. "text": "Los a went chip, of was returning cover, In the",
  208. "@fieldTypes": "date=t"
  209. },{
  210. "@type": "d", "@rid": "#12:477", "@version": 0, "@class": "Whiz",
  211. "id": 477,
  212. "date": "2011-12-09 00:00:00:000",
  213. "text": "He in office return He inside electronics for $500,000 Jay",
  214. "@fieldTypes": "date=t"
  215. }
  216. ]
  217. }