You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update transaction and query options specifications for GRPC and HTTP (#931)
## Goal
Add transaction and query options specification for GRPC and HTTP.
## Implementation
Update HTTP's answerCountLimit behavior for write queries to match the
updated behavior in typedb/typedb#7437.
Add a new section in the server transactions manual describing
transaction and query options.
Save descriptions and default values of the options in a separate
`resources` folder to:
* include them in asciidoc tables in the server transactions manual;
* include them in asciidoc tables in the HTTP endpoint api reference;
* copy them into the codegen comments in drivers.
Copy file name to clipboardExpand all lines: drivers/modules/ROOT/pages/http/api-reference.adoc
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -748,8 +748,18 @@ Open a new transaction and receive a unique transaction id.
748
748
[cols="h,3a"]
749
749
|===
750
750
| Field | Description
751
-
| `schemaLockAcquireTimeoutMillis` | Timeout for a schema transaction to acquire the exclusive schema lock of the database. Can be used to wait until a previous schema transaction finishes and releases the exclusivity lock. Specified in milliseconds. **Default:** 10 seconds.
752
-
| `transactionTimeoutMillis` | The maximum amount of time a transaction can stay opened. It will be closed automatically without preserving its changes and finishing its active queries after this timeout. Specified in milliseconds. **Default:** 5 minutes.
@@ -1043,19 +1053,19 @@ This endpoint allows running multiple sequential queries before committing.
1043
1053
[cols="h,3a"]
1044
1054
|===
1045
1055
| Field | Description
1046
-
| `includeInstanceTypes` | An optimization flag: whether to include the types of the returned instance concepts in concept row responses or not. **Default:** true.
1047
-
| `answerCountLimit` | The maximum allowed size of concept rows or concept documents answers returned. Used to limit the network load. **Default:** 10 000.
If used in a read query, at most `answerCountLimit` answers will be returned. If there are more answers cut, a relevant `warning` will be provided in the response.
Copy file name to clipboardExpand all lines: drivers/modules/ROOT/pages/http/index.adoc
+33-19Lines changed: 33 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ The TypeDB HTTP endpoint can be used to perform database management, user manage
4
4
5
5
== Server configuration
6
6
7
-
TypeDB server by runs both a gRPC (standard for most of the client applications) and an HTTP endpoint by default. Both endpoints have common authentication and xref:{page-version}@manual::configure/encryption.adoc[encryption settings]. Additionally, it is possible to disable the HTTP endpoint and change its default port.
7
+
TypeDB server by runs both a gRPC (standard for most of the client applications) and an HTTP endpoint by default.
8
+
Both endpoints have common authentication and xref:{page-version}@manual::configure/encryption.adoc[encryption settings].
9
+
Additionally, it is possible to disable the HTTP endpoint and change its default port.
Mostly all methods require Token-based authorization. These temporary tokens can be generated through a xref:{page-version}@drivers::http/api-reference.adoc#_sign_in[`POST` request to `localhost:8000/v1/signin`]. Provide your TypeDB user credentials in the request's body.
23
+
Mostly all methods require Token-based authorization.
24
+
These temporary tokens can be generated through a xref:{page-version}@drivers::http/api-reference.adoc#_sign_in[`POST` request to `localhost:8000/v1/signin`].
25
+
Provide your TypeDB user credentials in the request's body.
22
26
23
27
Change the xref:{page-version}@manual::configure/server.adoc#_command_line_arguments[`server.authentication.token_ttl_seconds`] parameter in the server's configuration to modify the time the tokens will remain valid before a new sign in request is required.
24
28
25
29
=== Encryption
26
30
27
-
If xref:{page-version}@manual::configure/encryption.adoc[server encryption] is set up, its settings are also applied to the HTTP endpoint, and the endpoint access will be additionally protected. Visit the xref:{page-version}@manual::configure/server.adoc#_encryption[server configuration] page for more details.
31
+
If xref:{page-version}@manual::configure/encryption.adoc[server encryption] is set up, its settings are also applied to the HTTP endpoint, and the endpoint access will be additionally protected.
32
+
Visit the xref:{page-version}@manual::configure/server.adoc#_encryption[server configuration] page for more details.
28
33
29
34
=== CORS
30
35
@@ -39,14 +44,18 @@ See xref:{page-version}@drivers::http/api-reference.adoc[] to access available d
39
44
40
45
=== Understanding query answers
41
46
42
-
The TypeDB HTTP endpoint supports all types of xref:{page-version}@manual::queries/transactions.adoc[transactions] and xref:{page-version}@manual::queries/index.adoc[queries]. The common xref:{page-version}@manual::queries/answers.adoc[query answer type], a list of concept rows, is represented in the HTTP endpoint like the following document:
47
+
The TypeDB HTTP endpoint supports all types of xref:{page-version}@manual::queries/transactions.adoc[transactions] and xref:{page-version}@manual::queries/index.adoc[queries].
48
+
The common xref:{page-version}@manual::queries/answers.adoc[query answer type], a list of concept rows, is represented in the HTTP endpoint like the following document:
43
49
44
50
.Concept rows answer
45
51
[%collapsible]
46
52
====
47
53
Each successful query response contains a query type, an answer type, an optional warning message, and the list of answers containing concepts (if applicable).
48
54
49
-
The `answers` field contains a list of documents with variables as keys and concepts as values. Each concept contains a `kind` field for unambiguous parsing. Each type has a label, and each instance has an optional description of its type, if the specific query option (`includeInstanceTypes`) is enabled. See all the possible concept variants below.
55
+
The `answers` field contains a list of documents with variables as keys and concepts as values.
56
+
Each concept contains a `kind` field for unambiguous parsing.
57
+
Each type has a label, and each instance has an optional description of its type, if the specific query option (`includeInstanceTypes`) is enabled.
@@ -57,7 +66,8 @@ The result above can be achieved in two different ways.
57
66
58
67
This will except you to manually open, close, and commit transactions used for querying.
59
68
60
-
Open a transaction using a `POST` request `/v1/transactions/open`. Provide an authorization token in the header (see xref:{page-version}@drivers::http/index.adoc#_authentication[authentication] above) and a JSON body, containing information about the target database and required transaction type:
69
+
Open a transaction using a `POST` request `/v1/transactions/open`.
70
+
Provide an authorization token in the header (see xref:{page-version}@drivers::http/index.adoc#_authentication[authentication] above) and a JSON body, containing information about the target database and required transaction type:
61
71
62
72
[source,json]
63
73
----
@@ -69,7 +79,9 @@ Open a transaction using a `POST` request `/v1/transactions/open`. Provide an au
69
79
70
80
[NOTE]
71
81
====
72
-
Schema transactions have an exclusive lock on the database and prevent other transactions from opening. If you don't close a schema transaction and lose its ID, it will be closed automatically based on the transaction timeout specified in the request (this parameter can be added to the request above):
82
+
Schema transactions have an exclusive lock on the database and prevent other transactions from opening.
83
+
If you don't close a schema transaction and lose its ID, it will be closed automatically based on the transaction timeout specified in the request (this parameter can be added to the request above):
84
+
73
85
[source,json]
74
86
----
75
87
"transactionOptions": {
@@ -79,6 +91,7 @@ Schema transactions have an exclusive lock on the database and prevent other tra
79
91
====
80
92
81
93
If everything is correct, you will receive a response containing a body like:
94
+
82
95
[source,json]
83
96
----
84
97
{
@@ -87,6 +100,7 @@ If everything is correct, you will receive a response containing a body like:
87
100
----
88
101
89
102
Then, send a `POST` query request to `v1/transactions/e1f8583c-2a03-4aac-a260-ec186369e86f/query` with the same authorization token in the header and the following JSON body included:
103
+
90
104
[source,json]
91
105
----
92
106
{
@@ -101,9 +115,12 @@ Don't forget to close the transaction when the work is done.
101
115
102
116
=== One-shot query
103
117
104
-
To avoid manual transaction management, a one-shot query endpoint can be used. It opens and automatically closes or commits a transaction for each query sent.
118
+
To avoid manual transaction management, a one-shot query endpoint can be used.
119
+
It opens and automatically closes or commits a transaction for each query sent.
120
+
121
+
Send a single `POST` request to `/v1/query`.
122
+
Provide an authorization token in the header (see xref:{page-version}@drivers::http/index.adoc#_authentication[authentication] above) and the following body containing information about the target database, transaction type required, query, and optional options:
105
123
106
-
Send a single `POST` request to `/v1/query`. Provide an authorization token in the header (see xref:{page-version}@drivers::http/index.adoc#_authentication[authentication] above) and the following body containing information about the target database, transaction type required, query, and optional options:
107
124
[source,json]
108
125
----
109
126
{
@@ -121,21 +138,18 @@ With this, you don't need to worry about forgotten transactions.
121
138
122
139
=== Running big queries
123
140
124
-
The current version of the HTTP endpoint does not support query answer streaming. Unlike in gRPC, the query results will be fully consumed before an initial answer is received on the client side, and the whole list of concept rows or documents will be returned in a single response.
141
+
The current version of the HTTP endpoint does not support query answer streaming.
142
+
Unlike in gRPC, the query results will be fully consumed before an initial answer is received on the client side, and the whole list of concept rows or documents will be returned in a single response.
125
143
126
-
While this mechanism will be enhanced in the future, for safety purposes, please use a special query option `answerCountLimit` to limit the amount of produced results and avoid too long query execution. The default value of ten thousand answers can be extended if you are ready for the consequences.
144
+
While this mechanism will be enhanced in the future, for safety purposes, please use a special query option `answerCountLimit` to limit the amount of produced results and avoid too long query execution.
145
+
The default value of ten thousand answers can be extended if you are ready for the consequences.
127
146
128
147
If this limit is hit:
129
148
130
-
- Read queries will return `206 Partial Content` with all the answers
131
-
processed;
132
-
- Write queries will stop their execution with an error, and the transaction will be closed without preserving intermediate results.
133
-
134
-
[NOTE]
135
-
====
136
-
This behaviour will be changed in the next stable version of TypeDB:
149
+
- Read queries will return `206 Partial Content` with all the answers processed;
150
+
- Write queries will be fully executed, and their changes can be committed.
151
+
The results will be returned with `206 Partial Content`.
137
152
138
-
- Write queries will be fully executed, and their changes can be committed. The results will be returned with the `206 Partial Content` code.
Copy file name to clipboardExpand all lines: manual/modules/ROOT/pages/migration/2_to_3.adoc
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
= TypeDB 2.x to 3.0
1
+
= TypeDB 2.x to 3.x
2
2
3
-
TypeDB 3.0 is a major leap forward, offering significantly improved performance and introducing a wide range of changes across almost every aspect of the database.
3
+
TypeDB 3.x is a major leap forward, offering significantly improved performance and introducing a wide range of changes across almost every aspect of the database.
4
4
This page outlines the key updates you should know, alongside recommendations for server and driver upgrades.
5
5
6
6
== Migration process
@@ -36,7 +36,9 @@ Click on a feature below for detailed documentation and examples.
36
36
37
37
* **Sessions Removed:** Connections to TypeDB now only require opening a `schema`, `write`, or `read` xref:{page-version}@manual::queries/transactions.adoc[transaction].
38
38
* **Integer Value Type Renamed:** `long` is now xref:{page-version}@typeql::values/integer.adoc[`integer`].
39
-
* **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`. Check out xref:{page-version}@manual::schema/schema_structure.adoc[] for more.
39
+
* **Kinds Introduced:** no more predefined root types and their subtyping through `person sub entity`, `friendship sub relation`, or `name sub attribute`.
40
+
Each new type should be declared with an explicit kind: `entity person`, `relation friendship`, and `attribute name`.
41
+
Check out xref:{page-version}@manual::schema/schema_structure.adoc[] for more.
40
42
* **Expanded User Management:** Authorization and user management are now included in all TypeDB editions.
41
43
Default credentials, if applicable, can be found in the xref:{page-version}@manual::connect/index.adoc[Connection Manual].
42
44
* **Updated Query Syntax:**
@@ -80,20 +82,18 @@ Take into account that some of your processes can be blocked if you previously r
80
82
81
83
* Database import and export tools.
82
84
* Configuration files (use CLI as a temporary solution).
83
-
* Transaction options.
84
-
* `update` queries (use `delete` + `insert` as a workaround).
85
-
* `contains` and `like` operators for `string` s.
86
-
* Instantiation restriction for inherited `owns` and `plays` (used to `as`). A better way is planned to be released in the future (NOTE: you don't need the `as` keyword to <<#_specialize, specialize>> an ownership of an inherited super attribute type with an ownership of its subtype).
85
+
* Instantiation restriction for inherited `owns` and `plays` (used to `as`).
86
+
A better way is planned to be released in the future (NOTE: you don't need the `as` keyword to <<#_specialize, specialize>> an ownership of an inherited super attribute type with an ownership of its subtype).
87
87
* Scaling support for Cloud and Enterprise editions.
88
88
89
89
=== TypeDB Drivers
90
90
91
91
* Node.js, C, C++, and C# drivers are not yet available.
92
+
Consider using one of xref:{page-version}@drivers::index.adoc[the available languages] or xref:{page-version}@drivers::http/index.adoc[the HTTP Endpoint].
92
93
93
94
=== TypeDB Studio
94
95
95
-
* **Graph visualizer** has been disabled due to incoming migration to an xref:{page-version}@manual::tools/code.adoc[IDE plugin]. Please consider using side tools for graph visualization if required.
96
-
* **Type browser** is temporarily unavailable and planned to be reimplemented in the xref:{page-version}@manual::tools/code.adoc[IDE plugin].
96
+
* **Graph visualizer** and **Type browser** are temporarily unavailable, but will be reimplemented and enhanced in the new TypeDB Studio soon.
0 commit comments