Crash course
The TypeDB crash course will give you a concise overview of the main aspects of working with TypeDB and TypeQL. For a more in-depth introduction, check out TypeDB Academy.
Introduction
The TypeDB crash course is divided into two sections: the environment setup, followed by a choice of pathways. Follow the instructions on this page to quickly set up the environment you’ll need for the crash course. At the end of this page, choose the pathway that most closely matches your previous database experience:
-
New databases users: Pathway for those completely new to databases.
-
Relational database users: Pathway for those used to working with relational databases.
-
Graph database users: Pathway for those used to working with graph databases.
Run TypeDB
To start TypeDB, select the TypeDB edition below and follow the instructions.
-
Cloud
-
Core
Log in to TypeDB Cloud and create a new deployment on the Deployments page.
For self-hosted TypeDB Cloud installation and setup, see the Self-hosted deployment page.
Ensure TypeDB Core is installed.
To start a locally installed TypeDB Core server:
typedb server
To create a new Docker container with TypeDB Core server:
docker volume create typedb-data
docker create --name typedb -v typedb-data:/opt/typedb-all-linux-x86_64/server/data -p 1729:1729 --platform linux/amd64 vaticle/typedb:latest
Connect to TypeDB
In this guide, we will use TypeDB Studio, the standalone GUI-based client for TypeDB. Ensure Studio is installed, then launch the application.
-
Cloud
-
Core
-
Click Connect to TypeDB on the right side of the top toolbar.
-
Switch the
Server
field drop-down toTypeDB Cloud
. -
Click Manage Cloud Addresses button.
-
Add address and port for at least one server from your TypeDB Cloud deployment, then close the Address Management window.
-
Fill in the
Username
andPassword
fields with valid user credentials.For newly created deployments, the default username and password are
admin
andpassword
. After connecting for the first time, you will be required to change the password before queries can be run. -
Turn on the
Enable TLS
option and leave theCA Certificate
field empty. For self-hosted deployments, encryption parameters may vary. -
Click
Connect
.
Create a project
TypeDB Studio stores queries you create as TypeQL files in a local project directory. To select a project directory, click either Open Project in the Project panel, or the Open Project Directory button in the top toolbar.
Create a new database
To create a new database:
-
Click the
Manage Databases button in the top toolbar.
-
Enter a name for a new database and click Create.
-
Select the new database from the Select Database dropdown (
) in the top toolbar.
Running queries
To run a query:
-
Make sure you are using the correct session type and transaction type. You can change these using the session type toggle (
) and transaction type toggle (
) in the top toolbar. The course material will tell you which session and transaction type to use for each query, but you can also refer to the following table.
Session type Transaction type Query types schema
write
Define
data
write
Insert, Delete, Update
data
read
Fetch, Get
-
Open a
New Tab in the Text Editor and paste in the query.
-
Click the
Run Query button.
-
If the transaction is a
write
transaction: when the query has completed, clickCommit Transaction. The course material will tell you when this is necessary.