|
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | 8 | "# Visualising TypeDB Data with Python\n", |
| 9 | + "> **Note:** This tutorial requires a running TypeDB server with version >=3.7.0. The connection details can be modified in the cell below if required.\n", |
| 10 | + "> It also requires the folllowing python packages which can be installed from pip:\n", |
| 11 | + "> \n", |
| 12 | + "> `python3 -m pip install \"typedb-driver>=3.7.0\" \"typedb-graph-utils>=3.7.0\" \"jupyter\"`\n", |
| 13 | + "> \n", |
9 | 14 | "This is a tutorial to visualise TypeDB data as graphs using the query representation returned by the analyze endpoint,\n", |
10 | 15 | "and with query results (when the `include_query_structure` `QueryOption` is set).\n", |
11 | 16 | "\n", |
|
33 | 38 | "metadata": {}, |
34 | 39 | "outputs": [], |
35 | 40 | "source": [ |
| 41 | + "from typedb.driver import Credentials, DriverOptions, QueryOptions\n", |
| 42 | + "\n", |
| 43 | + "DB_ADDRESS = \"127.0.0.1:1729\"\n", |
| 44 | + "DB_CREDENTIALS = Credentials(\"admin\", \"password\")\n", |
| 45 | + "DRIVER_OPTIONS = DriverOptions(is_tls_enabled=False)\n", |
| 46 | + "QUERY_OPTIONS = QueryOptions()\n", |
| 47 | + "QUERY_OPTIONS.include_query_structure = True\n", |
| 48 | + "DB_NAME = \"typedb-graph-tutorial-py\"\n", |
| 49 | + "\n", |
36 | 50 | "SCHEMA = \"\"\"\n", |
37 | 51 | "define\n", |
38 | 52 | " attribute name, value string;\n", |
|
58 | 72 | "metadata": {}, |
59 | 73 | "outputs": [], |
60 | 74 | "source": [ |
61 | | - "from typedb.driver import TypeDB, Credentials, DriverOptions, TypeDB, QueryOptions, TransactionType\n", |
62 | | - "\n", |
63 | | - "DB_ADDRESS = \"127.0.0.1:1729\"\n", |
64 | | - "DB_CREDENTIALS = Credentials(\"admin\", \"password\")\n", |
65 | | - "DRIVER_OPTIONS = DriverOptions(is_tls_enabled=False)\n", |
66 | | - "QUERY_OPTIONS = QueryOptions()\n", |
67 | | - "QUERY_OPTIONS.include_query_structure = True\n", |
68 | | - "DB_NAME = \"typedb-graph-tutorial-py\"\n", |
| 75 | + "from typedb.driver import TypeDB, TypeDB, TransactionType\n", |
69 | 76 | "\n", |
70 | 77 | "def setup(driver, schema, data):\n", |
71 | 78 | " if DB_NAME in [db.name for db in driver.databases.all()]:\n", |
|
707 | 714 | "name": "python", |
708 | 715 | "nbconvert_exporter": "python", |
709 | 716 | "pygments_lexer": "ipython3", |
710 | | - "version": "3.11.11" |
| 717 | + "version": "3.9.18" |
711 | 718 | } |
712 | 719 | }, |
713 | 720 | "nbformat": 4, |
|
0 commit comments