# TypeDB 2.x to TypeDB 3.x: what’s changed

This page outlines the key updates of TypeDB 3.x compared to 2.x you should be aware of while transitioning between these versions.

This section highlights **changes from TypeDB 2.x**, not all new features in 3.x. Explore the [TypeQL Concepts](../../../core-concepts/typeql/index.md), [TypeQL Reference](../../../typeql-reference/index.md), and [release notes](https://github.com/typedb/typedb/releases) for the full picture. Stay tuned for upcoming blogs showcasing new features!

Click on a feature below for detailed documentation and examples.

## [](#_typedb_and_typeql)TypeDB and TypeQL

*   **Sessions Removed:** Connections to TypeDB now only require opening a `schema`, `write`, or `read` [transaction](../../../core-concepts/typedb/transactions/index.md).
    
*   **Integer Value Type Renamed:** `long` is now `integer`.
    
*   **Kinds Introduced:** no more predefined root types and their subtyping through `person sub entity`, `friendship sub relation`, or `name sub attribute`. Each new type should be declared with an explicit kind: `entity person`, `relation friendship`, and `attribute name`.
    
*   **Expanded User Management:** Authorization and user management are now included in all TypeDB editions. Default credentials, if applicable, can be found in the [Connections page](../../../core-concepts/drivers/connections/index.md).
    
*   **Updated Query Syntax:**
    
    *   [`undefine`](../../../typeql-reference/schema/undefine/index.md) and [`delete`](../../../typeql-reference/pipelines/delete/index.md) now explicitly "point" to their removed targets, reducing ambiguity.
        
    *   [`fetch`](../../../typeql-reference/pipelines/fetch/index.md) syntax aligns with JSON output formatting.
        
    *   [`match`](../../../typeql-reference/pipelines/match/index.md) produces visible row-like results itself (similarly to [`insert`](../../../typeql-reference/pipelines/insert/index.md), etc): no more `get` s!
        
    *   All `$vars` start with `$`: no more `?` for value variables! However, it is still easy to differentiate their declaration with the new [`let` keyword](../../../typeql-reference/statements/let-eq/index.md).
        
    
*   **Annotations and Statements Consolidated:** [`abstract`](../../../typeql-reference/annotations/abstract/index.md) and [`regex`](../../../typeql-reference/annotations/regex/index.md) are now grouped under [@annotations](../../../typeql-reference/annotations/index.md).
    
*   **Smoother trait specialization:**
    
    *   It is possible to redefine already inherited `owns` and `plays` on subtypes, adding more annotations to them.
        
    *   The `as` keyword is no longer applicable to `owns` and `plays`. This guarantees that every subtype owns all attributes and plays all roles that its supertypes do.
        
    *   As before, use the `as` keyword to [specialize a `relates`](../../../typeql-reference/statements/relates/index.md).
        
    
*   **Default Cardinalities:**
    
    *   Default cardinalities are applied to `owns`, `relates`, and `plays` if not explicitly defined.
        
    *   Default `plays` cardinality: `@card(0..)` (unlimited).
        
    *   Default `owns` and `relates` cardinality: `@card(0..1)` (up to one instance). Explicitly define cardinalities for traits expecting multiple instances to avoid data corruption and optimize database performance.
        
    
*   **Rules and Inference Replaced:** Rules are now replaced by [functions](../../../typeql-reference/functions/index.md), requiring explicit functions execution instead of inference, but offering more abstraction and flexibility.
    

## [](#_major_changes_drivers)TypeDB Drivers

**API Simplification** for smoother UX and better maintenance. Visit the [Reference](../../index.md) to access their full documentation.

*   Now, all schema and data fetching and modifications are performed through a single `transaction.query("your query")` interface.
    
*   No more `query().insert()` and `query().define()`.
    
*   No more `concept.delete()` or `concept.getHas()`.
    
*   Concept structure is preserved (the only difference: `Thing` is renamed to `Instance`), casts are available, and it is possible to retrieve something simple as a type’s label or an attribute’s value, that are sent with the type itself.
    
*   In OOP languages (like Java and Python), concepts have `try` versions of their methods, available for any concept and returning optional results. Using casting, the concrete methods returning results directly become available, as in 2.x.
    

## [](#_temporarily_missing)Temporarily missing features

This section contains the list of features that were introduced in 2.x, but are still under development in 3.x. Take into account that some of your processes can be blocked if you previously relied on these features.

### [](#_typedb_and_typeql_2)TypeDB and TypeQL

*   Instantiation restriction for inherited `owns` and `plays` (used to `as`). An enhanced approach is in development (NOTE: you don’t need the `as` keyword to specialize an ownership of an inherited super attribute type with an ownership of its subtype, but you cannot "hide" the original definition from inheritance).
    
*   Scaling support for Cloud and Enterprise editions.
    

### [](#_typedb_drivers)TypeDB Drivers

*   Node.js, C, C++, and C# drivers are not yet available. Consider using one of [the available languages](../../typedb-grpc-drivers/index.md) or [the HTTP Endpoint](../../typedb-http-api/index.md).
    

## [](#_typeql_2_to_3_schema_cheatsheet)TypeQL 2 to 3 schema cheatsheet

  

TypeQL 2 Construct

TypeQL 3 Equivalent

Notes

`define person sub entity`

`define entity person`

`define employment sub relation`

`define relation employment`

`define name sub attribute`

`define attribute name`

`define age sub attribute, value long`

`define attribute age, value integer`

`define object sub entity, abstract`

`define entity object @abstract`

`define phone-number sub attribute, regex "\\d{10}"`

`define attribute phone-number @regex "\\d{10}"`

`define child owns child-name as name`

`define entity child, owns name`

`as` is no longer applicable to `owns`

`define child plays child-employee as employee`

`define entity child, plays employee`

`as` is no longer applicable to `plays`

`define rule my-rule`

Use functions instead

Rules are now replaced by functions

Everything else is the same syntax-wise, but do check [TypeDB and TypeQL](#_typedb_and_typeql) for implicit changes such as default cardinalities.

## [](#_having_troubles)Having troubles?

For troubleshooting tips and guidance, refer to the [Troubleshooting page](../../../maintenance-operation/troubleshooting/index.md).

[TypeDB 2.x vs TypeDB 3.x](../index.md) [TypeDB 2.x to TypeDB 3.x: migration process](../process/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/reference/modules/ROOT/pages/typedb-2-vs-3/diff.adoc) Edit this page on GitHub.