TerminusX Logo Colour
Getting Started with TerminusDB using the Python Client

Getting Started with TerminusDB using the Python Client

Our Developer Relationship Associate, Cheuk Ting Ho, recently put together this six-part tutorial to demonstrate how to get started with TerminusDB and TerminusX using the Python client.

The six videos detail everything you need to know about working with TerminusDB using the Python client including setting up a blank database, importing data from CSVs, updating and linking data, preparing data for analysis, and lots more.

For the full tutorial, visit our documentation site: Getting Started with Python Tutorial.

Lesson 1: Using the Python client to start a project and create a database with schema

Cheuk skips over installing TerminusDB as the instructions to install from source code or install as a Docker container can be found in our documentation. But for your ease and convenience, TerminusX enables you to get started straight away, sign up if you haven’t already.

This lesson shows you how to start a project, how to create a schema in Python, and then how to commit the schema into TerminusDB/X to create the new database.

Tutorial: Lesson 1 – Using the Python client to start a project and create a database with schema

Lesson 2: Importing CSV files into your database

So you created your database with schema in lesson 1, the next job is to import some data into it. In lesson 2, Cheuk shows you how to use the TerminusDB importcsv command. It also demonstrates how to link data together in your import, the example here is a list of employees, some of whom are managers of others in the dataset.

Tutorial: Lesson 2 – Importing CSV files into your database

Lesson 3: Importing data using a Python script

When data is more complex, importing data from CSV might not be the answer. Here you would use a Python script to import objects, that would become documents in TerminusDB/X; enums, and other variables into your database. As well as covering how to create and run a Python script, lesson 3 also includes some handy tips like using the schema.py to import classes and objects from the schema into the script.

Tutorial: Lesson 3 – Importing data using a Python script

Lesson 4: Updating the database with new and amended data

Lesson 4 uses a Python script to update the database you created with new records and to update existing information in your database. Cheuk talks you through getting the schema and documents from the database to update or replace with new information.

Tutorial: Lesson 4 – Updating the database with new and amended data

Lesson 5: Query the database and get results back in CSV or DataFrames

Cheuk shows you how to query and export the entire database, or specific documents to CSV. She also goes into more detail about how to export to Pandas DataFrames should you need to do a more in-depth analysis of your data.

Tutorial: Lesson 5 – Query the database and get results back in CSV or DataFrames

Lesson 6: Version control – Branching, time travel, and rebase

Lesson 6 is all about version control and how branching can aid collaborative working and allow you to time travel across different versions of your data and reset to previous versions, all from the Python client. 

Tutorial: Lesson 6 – Version control, branching, time travel, and rebase

Get on board with TerminusX

If you haven’t already, sign up for the TerminusX public beta. TerminusX is a cloud-based data product builder with version control at its heart. Invite team members to work with your data and create a vibrant document-oriented graph database to build apps, services, and big insights.
TerminusX Whitepaper

TerminusX & Data Mesh

Interested in how TerminusX can help you achieve your data mesh ambitions? Download the whitepaper to find out more info.

TerminusDB newsletter sign up

Sign up to our newsletter

Stay up to date in the world of data by signing up to the TerminusDB newsletter.

Latest Stories

Talk to the team

If you've got questions or want to be part of the TerminusDB community, come say hi on Discord.
Community