|
988 | 988 | { |
989 | 989 | "cell_type": "markdown", |
990 | 990 | "metadata": {}, |
991 | | - "source": [ |
992 | | - "The API supports the following column types:\n", |
993 | | - "\n", |
994 | | - "- `number`: Numeric values\n", |
995 | | - "- `longText`: Text content\n", |
996 | | - "- `select`: Single selection from predefined options\n", |
997 | | - "- `date`: Date values\n", |
998 | | - "- `multiSelect`: Multiple selections from predefined options\n", |
999 | | - "- `checkbox`: Boolean values\n", |
1000 | | - "- `custom`: Custom column types with specific behavior\n", |
1001 | | - "\n", |
1002 | | - "Each column type has specific settings that can be configured through the `settings` object." |
1003 | | - ] |
| 991 | + "source": [] |
1004 | 992 | }, |
1005 | 993 | { |
1006 | 994 | "cell_type": "code", |
|
1099 | 1087 | { |
1100 | 1088 | "data": { |
1101 | 1089 | "text/plain": [ |
1102 | | - "{'id': 'ebc3dd3e-f88b-4f8b-8c72-6cfcae0a0cd4',\n", |
| 1090 | + "{'id': 'cc6794e1-3505-4d5c-b403-ca7e55142bbc',\n", |
1103 | 1091 | " 'name': 'New Dataset for testing columns',\n", |
1104 | 1092 | " 'description': 'This is a new dataset for testing columns',\n", |
1105 | | - " 'updated_at': '2025-04-10T00:12:43.359691+00:00',\n", |
1106 | | - " 'created_at': '2025-04-10T00:12:43.359691+00:00',\n", |
| 1093 | + " 'updated_at': '2025-04-16T18:05:53.249101+00:00',\n", |
| 1094 | + " 'created_at': '2025-04-16T18:05:53.249101+00:00',\n", |
1107 | 1095 | " 'version_counter': 0,\n", |
1108 | | - " 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}" |
| 1096 | + " 'project_id': '3d9b529b-c23f-4e87-8a26-dd1923749aa7'}" |
1109 | 1097 | ] |
1110 | 1098 | }, |
1111 | 1099 | "execution_count": null, |
|
1130 | 1118 | { |
1131 | 1119 | "data": { |
1132 | 1120 | "text/plain": [ |
1133 | | - "{'id': 'new_column_3',\n", |
1134 | | - " 'name': 'New Column 3',\n", |
1135 | | - " 'type': 'text',\n", |
1136 | | - " 'settings': {'id': 'new_column_3',\n", |
1137 | | - " 'name': 'New Column 3',\n", |
1138 | | - " 'type': 'text',\n", |
1139 | | - " 'max_length': 255,\n", |
1140 | | - " 'is_required': True},\n", |
1141 | | - " 'created_at': '2025-04-10T02:22:07.300895+00:00',\n", |
1142 | | - " 'updated_at': '2025-04-10T02:22:07.300895+00:00',\n", |
1143 | | - " 'datatable_id': 'ebc3dd3e-f88b-4f8b-8c72-6cfcae0a0cd4'}" |
| 1121 | + "{'id': 'new_column_5',\n", |
| 1122 | + " 'name': 'New Column 5',\n", |
| 1123 | + " 'type': 'select',\n", |
| 1124 | + " 'settings': {'id': 'new_column_5',\n", |
| 1125 | + " 'name': 'New Column 5',\n", |
| 1126 | + " 'type': 'select',\n", |
| 1127 | + " 'width': 255,\n", |
| 1128 | + " 'options': [{'name': 'name', 'value': 'name'},\n", |
| 1129 | + " {'name': 'age', 'value': 'age'},\n", |
| 1130 | + " {'name': 'gender', 'value': 'gender'}],\n", |
| 1131 | + " 'isVisible': True,\n", |
| 1132 | + " 'isEditable': True},\n", |
| 1133 | + " 'created_at': '2025-04-16T18:11:14.305975+00:00',\n", |
| 1134 | + " 'updated_at': '2025-04-16T18:11:14.305975+00:00',\n", |
| 1135 | + " 'datatable_id': 'cc6794e1-3505-4d5c-b403-ca7e55142bbc'}" |
1144 | 1136 | ] |
1145 | 1137 | }, |
1146 | 1138 | "execution_count": null, |
|
1153 | 1145 | "new_column = await client.create_dataset_column(\n", |
1154 | 1146 | " project_id=projects[\"items\"][0][\"id\"],\n", |
1155 | 1147 | " dataset_id=datasets[\"id\"],\n", |
1156 | | - " id=\"new_column_3\",\n", |
| 1148 | + " id=\"new_column_5\",\n", |
1157 | 1149 | " name=\"New Column 3\",\n", |
1158 | | - " type=ColumnType.TEXT.value,\n", |
| 1150 | + " type=ColumnType.SELECT.value,\n", |
1159 | 1151 | " settings={\n", |
1160 | | - " \"max_length\": 255,\n", |
1161 | | - " \"is_required\": True,\n", |
| 1152 | + " \"width\": 255,\n", |
| 1153 | + " \"isVisible\": True,\n", |
| 1154 | + " \"isEditable\": True,\n", |
| 1155 | + " \"options\": [\n", |
| 1156 | + " {\"name\": \"name\", \"color\": \"hsl(200, 100%, 50%)\", \"value\": \"name\"},\n", |
| 1157 | + " {\"name\": \"age\", \"color\": \"hsl(200, 100%, 50%)\", \"value\": \"age\"},\n", |
| 1158 | + " {\"name\": \"gender\", \"color\": \"hsl(200, 100%, 50%)\", \"value\": \"gender\"},\n", |
| 1159 | + " ]\n", |
1162 | 1160 | " },\n", |
1163 | 1161 | ")\n", |
1164 | 1162 | "new_column" |
|
1172 | 1170 | { |
1173 | 1171 | "data": { |
1174 | 1172 | "text/plain": [ |
1175 | | - "{'items': [{'id': 'new_column_3',\n", |
1176 | | - " 'name': 'New Column 3',\n", |
1177 | | - " 'type': 'text',\n", |
1178 | | - " 'settings': {'id': 'new_column_3',\n", |
1179 | | - " 'name': 'New Column 3',\n", |
1180 | | - " 'type': 'text',\n", |
1181 | | - " 'max_length': 255,\n", |
1182 | | - " 'is_required': True},\n", |
1183 | | - " 'created_at': '2025-04-10T02:22:07.300895+00:00',\n", |
1184 | | - " 'updated_at': '2025-04-10T02:22:07.300895+00:00',\n", |
1185 | | - " 'datatable_id': 'ebc3dd3e-f88b-4f8b-8c72-6cfcae0a0cd4'}],\n", |
| 1173 | + "{'items': [{'id': 'dQ7hCb1AUfog',\n", |
| 1174 | + " 'name': 'tags_color_coded',\n", |
| 1175 | + " 'type': 'select',\n", |
| 1176 | + " 'settings': {'id': 'dQ7hCb1AUfog',\n", |
| 1177 | + " 'name': 'tags_color_coded',\n", |
| 1178 | + " 'type': 'select',\n", |
| 1179 | + " 'width': 255,\n", |
| 1180 | + " 'options': [{'name': 'red', 'color': 'hsl(0, 85%, 60%)', 'value': 'red'},\n", |
| 1181 | + " {'name': 'green', 'color': 'hsl(30, 85%, 60%)', 'value': 'green'},\n", |
| 1182 | + " {'name': 'blue', 'color': 'hsl(45, 85%, 60%)', 'value': 'blue'}],\n", |
| 1183 | + " 'isVisible': True,\n", |
| 1184 | + " 'isEditable': True},\n", |
| 1185 | + " 'created_at': '2025-04-16T19:00:39.936764+00:00',\n", |
| 1186 | + " 'updated_at': '2025-04-16T19:00:39.936764+00:00',\n", |
| 1187 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'},\n", |
| 1188 | + " {'id': 'eCAiMBRqm0Uc',\n", |
| 1189 | + " 'name': 'id',\n", |
| 1190 | + " 'type': 'number',\n", |
| 1191 | + " 'settings': {'id': 'eCAiMBRqm0Uc',\n", |
| 1192 | + " 'name': 'id',\n", |
| 1193 | + " 'type': 'number',\n", |
| 1194 | + " 'width': 255,\n", |
| 1195 | + " 'isVisible': True,\n", |
| 1196 | + " 'isEditable': True},\n", |
| 1197 | + " 'created_at': '2025-04-16T19:00:39.971857+00:00',\n", |
| 1198 | + " 'updated_at': '2025-04-16T19:00:39.971857+00:00',\n", |
| 1199 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'},\n", |
| 1200 | + " {'id': 'fRegl7Ucx3Sp',\n", |
| 1201 | + " 'name': 'description',\n", |
| 1202 | + " 'type': 'longText',\n", |
| 1203 | + " 'settings': {'id': 'fRegl7Ucx3Sp',\n", |
| 1204 | + " 'name': 'description',\n", |
| 1205 | + " 'type': 'longText',\n", |
| 1206 | + " 'width': 255,\n", |
| 1207 | + " 'isVisible': True,\n", |
| 1208 | + " 'isEditable': True,\n", |
| 1209 | + " 'max_length': 1000},\n", |
| 1210 | + " 'created_at': '2025-04-16T19:00:40.055047+00:00',\n", |
| 1211 | + " 'updated_at': '2025-04-16T19:00:40.055047+00:00',\n", |
| 1212 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'},\n", |
| 1213 | + " {'id': 'foebrzYhiu9x',\n", |
| 1214 | + " 'name': 'tags',\n", |
| 1215 | + " 'type': 'select',\n", |
| 1216 | + " 'settings': {'id': 'foebrzYhiu9x',\n", |
| 1217 | + " 'name': 'tags',\n", |
| 1218 | + " 'type': 'select',\n", |
| 1219 | + " 'width': 255,\n", |
| 1220 | + " 'options': [{'name': 'tag1', 'color': 'hsl(0, 85%, 60%)', 'value': 'tag1'},\n", |
| 1221 | + " {'name': 'tag2', 'color': 'hsl(30, 85%, 60%)', 'value': 'tag2'},\n", |
| 1222 | + " {'name': 'tag3', 'color': 'hsl(45, 85%, 60%)', 'value': 'tag3'}],\n", |
| 1223 | + " 'isVisible': True,\n", |
| 1224 | + " 'isEditable': True},\n", |
| 1225 | + " 'created_at': '2025-04-16T19:00:40.084457+00:00',\n", |
| 1226 | + " 'updated_at': '2025-04-16T19:00:40.084457+00:00',\n", |
| 1227 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'},\n", |
| 1228 | + " {'id': 'ciAzRUhKct9c',\n", |
| 1229 | + " 'name': 'name',\n", |
| 1230 | + " 'type': 'longText',\n", |
| 1231 | + " 'settings': {'id': 'ciAzRUhKct9c',\n", |
| 1232 | + " 'name': 'name',\n", |
| 1233 | + " 'type': 'longText',\n", |
| 1234 | + " 'width': 255,\n", |
| 1235 | + " 'isVisible': True,\n", |
| 1236 | + " 'isEditable': True,\n", |
| 1237 | + " 'max_length': 1000},\n", |
| 1238 | + " 'created_at': '2025-04-16T19:00:40.232989+00:00',\n", |
| 1239 | + " 'updated_at': '2025-04-16T19:00:40.232989+00:00',\n", |
| 1240 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'},\n", |
| 1241 | + " {'id': 'iAW5muBh9mc251p8-LqKz',\n", |
| 1242 | + " 'name': 'url',\n", |
| 1243 | + " 'type': 'url',\n", |
| 1244 | + " 'settings': {'id': 'iAW5muBh9mc251p8-LqKz',\n", |
| 1245 | + " 'name': 'url',\n", |
| 1246 | + " 'type': 'url',\n", |
| 1247 | + " 'width': 192,\n", |
| 1248 | + " 'position': 5,\n", |
| 1249 | + " 'isVisible': True,\n", |
| 1250 | + " 'isEditable': True},\n", |
| 1251 | + " 'created_at': '2025-04-16T20:13:09.418698+00:00',\n", |
| 1252 | + " 'updated_at': '2025-04-16T20:13:16.914367+00:00',\n", |
| 1253 | + " 'datatable_id': '271b8bc7-2d04-43b8-8960-ce20365f546b'}],\n", |
1186 | 1254 | " 'pagination': {'offset': 0,\n", |
1187 | 1255 | " 'limit': 50,\n", |
1188 | | - " 'total': 1,\n", |
| 1256 | + " 'total': 6,\n", |
1189 | 1257 | " 'order_by': 'created_at',\n", |
1190 | 1258 | " 'sort_dir': 'asc'}}" |
1191 | 1259 | ] |
|
1196 | 1264 | } |
1197 | 1265 | ], |
1198 | 1266 | "source": [ |
1199 | | - "await client.list_dataset_columns(projects[\"items\"][0][\"id\"], datasets[\"id\"])" |
| 1267 | + "await client.list_dataset_columns(projects[\"items\"][0][\"id\"], \"271b8bc7-2d04-43b8-8960-ce20365f546b\")" |
1200 | 1268 | ] |
1201 | 1269 | }, |
1202 | 1270 | { |
|
1362 | 1430 | { |
1363 | 1431 | "data": { |
1364 | 1432 | "text/plain": [ |
1365 | | - "{'id': 'new_row_1',\n", |
1366 | | - " 'data': {'id': 'new_row_1', 'new_column_1': 'value', 'new_column_2': 'value'},\n", |
1367 | | - " 'created_at': '2025-04-10T02:22:34.470887+00:00',\n", |
1368 | | - " 'updated_at': '2025-04-10T02:22:34.470887+00:00',\n", |
1369 | | - " 'datatable_id': 'ebc3dd3e-f88b-4f8b-8c72-6cfcae0a0cd4'}" |
| 1433 | + "'3374b891-8398-41bd-8f81-2867759df294'" |
| 1434 | + ] |
| 1435 | + }, |
| 1436 | + "execution_count": null, |
| 1437 | + "metadata": {}, |
| 1438 | + "output_type": "execute_result" |
| 1439 | + } |
| 1440 | + ], |
| 1441 | + "source": [ |
| 1442 | + "datasets[\"id\"]" |
| 1443 | + ] |
| 1444 | + }, |
| 1445 | + { |
| 1446 | + "cell_type": "code", |
| 1447 | + "execution_count": null, |
| 1448 | + "metadata": {}, |
| 1449 | + "outputs": [ |
| 1450 | + { |
| 1451 | + "data": { |
| 1452 | + "text/plain": [ |
| 1453 | + "{'id': '',\n", |
| 1454 | + " 'data': {'id': '', 'new_column_3': 'name'},\n", |
| 1455 | + " 'created_at': '2025-04-16T17:46:39.100525+00:00',\n", |
| 1456 | + " 'updated_at': '2025-04-16T17:46:39.100525+00:00',\n", |
| 1457 | + " 'datatable_id': '3374b891-8398-41bd-8f81-2867759df294'}" |
1370 | 1458 | ] |
1371 | 1459 | }, |
1372 | 1460 | "execution_count": null, |
|
1378 | 1466 | "await client.create_dataset_row(\n", |
1379 | 1467 | " project_id=projects[\"items\"][0][\"id\"],\n", |
1380 | 1468 | " dataset_id=datasets[\"id\"],\n", |
1381 | | - " id=\"new_row_1\",\n", |
1382 | | - " data={\"new_column_1\": \"value\", \"new_column_2\": \"value\"},\n", |
| 1469 | + " id=\"\",\n", |
| 1470 | + " data={\"new_column_3\": \"name\"},\n", |
1383 | 1471 | ")\n" |
1384 | 1472 | ] |
1385 | 1473 | }, |
|
0 commit comments