Skip to content

Commit

Permalink
Update version to 3.0.0-alpha-6. Fix circleCI python dependencies. Up…
Browse files Browse the repository at this point in the history
…date typedb driver dependency. Add a better usage of query types in printing
  • Loading branch information
farost committed Oct 18, 2024
1 parent c30b96f commit 5aec62b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ commands:
type: string
steps:
- run: |
brew install python@3.8
brew install python@3.9
curl -OL "https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-darwin-<<parameters.bazel-arch>>"
sudo mv "bazelisk-darwin-<<parameters.bazel-arch>>" /usr/local/bin/bazel
chmod a+x /usr/local/bin/bazel
Expand Down
43 changes: 36 additions & 7 deletions RELEASE_NOTES_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
## Distribution

Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/public-release/packages/?q=name:^typedb-console+version:3.0.0-alpha-4
Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/public-release/packages/?q=name:^typedb-console+version:3.0.0-alpha-6


## New Features
- **Introduce TypeDB 3.0-alpha Console**
Reimagine TypeDB Console for the upcoming 3.0 release of TypeDB. This alpha version of the client lets you interact with the updated server, try out the new, even more elegant version of TypeQL, and get used to the new output format for data queries.
Learn more about TypeDB 3.0 features here: https://typedb.com/blog/typedb-3-roadmap

- **Add fetch queries result printing.** We add `ConceptDocument` printer option to show the results of `fetch`
queries.

That's how we print the `match` and `fetch` queries results now:
```
hi::read> match $x isa! person;
Finished validation and compilation...
Streaming answers...
--------
$x | iid 0x1e00000000000000000000 isa person
--------
Finished. Total answers: 1
hi::read> match $x isa! person; fetch {$x.*};
Finished validation and compilation...
Streaming documents...
{
"age": [ 25 ],
"balance": [ "1234567890.000123456789" ],
"birth-date": [ "2024-09-20" ],
"birth-time": [ "1999-02-26T12:15:05.000000000" ],
"current-time": [ "2024-09-20T16:40:05.000000000 Europe/London" ],
"current-time-off": [ "2024-09-20T16:40:05.028129323+05:45" ],
"expiration": [ "P1Y10M7DT15H44M5.003948920S" ],
"is-new": [ true ],
"name": [ "John" ],
"success": [ 66.6 ]
}
Finished. Total answers: 1
```

## Bugs Fixed

Expand All @@ -16,5 +47,3 @@ Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/pub


## Other Improvements


6 changes: 4 additions & 2 deletions TypeDBConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.typedb.console.common.util.Java;
import com.typedb.driver.TypeDB;
import com.typedb.driver.api.Driver;
import com.typedb.driver.api.QueryType;
import com.typedb.driver.api.Transaction;
import com.typedb.driver.api.answer.ConceptRow;
import com.typedb.driver.api.answer.JSON;
Expand Down Expand Up @@ -713,20 +714,21 @@ private void runQuery(Transaction tx, String queryString) {

private void runQueryPrintAnswers(Transaction tx, String queryString) {
QueryAnswer answer = tx.query(queryString).resolve();
QueryType queryType = answer.getQueryType();
if (answer.isOk()) {
printer.info(QUERY_SUCCESS);
} else if (answer.isConceptRows()) {
Stream<ConceptRow> resultRows = answer.asConceptRows().stream();
AtomicBoolean first = new AtomicBoolean(true);
printCancellableResult(resultRows, row -> {
printer.conceptRow(row, tx, first.get());
printer.conceptRow(row, queryType, tx, first.get());
first.set(false);
});
} else if (answer.isConceptDocuments()) {
Stream<JSON> resultDocuments = answer.asConceptDocuments().stream();
AtomicBoolean first = new AtomicBoolean(true);
printCancellableResult(resultDocuments, document -> {
printer.conceptDocument(document, first.get());
printer.conceptDocument(document, queryType, first.get());
first.set(false);
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-alpha-4
3.0.0-alpha-6
8 changes: 4 additions & 4 deletions common/Printer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ public void error(String s) {
err.println(colorError(s));
}

public void conceptRow(ConceptRow conceptRow, Transaction tx, boolean first) {
public void conceptRow(ConceptRow conceptRow, QueryType queryType, Transaction tx, boolean first) {
List<String> columnNames = conceptRow.columnNames().collect(Collectors.toList());
int columnsWidth = columnNames.stream().map(String::length).max(Comparator.comparingInt(Integer::intValue)).orElse(0);
if (first) {
out.println(conceptRowDisplayStringHeader(conceptRow.getQueryType(), columnsWidth));
out.println(conceptRowDisplayStringHeader(queryType, columnsWidth));
}
out.println(conceptRowDisplayString(conceptRow, columnNames, columnsWidth, tx));
}

public void conceptDocument(JSON conceptDocument, boolean first) {
public void conceptDocument(JSON conceptDocument, QueryType queryType, boolean first) {
if (first) {
out.println(conceptDocumentDisplayHeader(QueryType.READ)); // TODO: Get the query type from the document when available
out.println(conceptDocumentDisplayHeader(queryType));
}
out.println(conceptDocumentDisplay(conceptDocument));
}
Expand Down
2 changes: 1 addition & 1 deletion dependencies/vaticle/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ def vaticle_typedb_driver():
git_repository(
name = "vaticle_typedb_driver",
remote = "https://github.com/typedb/typedb-driver",
commit = "32152553cea3e8af6e1ef616ea626693d76e6228", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_driver
tag = "3.0.0-alpha-6", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_driver
)

0 comments on commit 5aec62b

Please sign in to comment.