Skip to content

Commit d7f9c9f

Browse files
authored
update structure of client support for v2 transactions, and access interface for transaction results (#37)
* update structure of client support for v2 transactions, and access interface for transaction results. * update go version in github action. * hide concrete column implementations, all access through column interface, plus misc cleanups and minor improvements to examples. * fix constant values in relation signatures and update tests.
1 parent ebe80bb commit d7f9c9f

File tree

54 files changed

+5816
-841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5816
-841
lines changed

.github/workflows/go-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v2
1616
with:
17-
go-version: 1.17
17+
go-version: 1.18
1818

1919
- name: Build
2020
run: go build -v ./rai

CHANGELOG.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
# Changelog
22

3+
## v0.4.0-alpha
4+
5+
* Complete overhaul of transaction response handling and results access API.
6+
37
## v0.3.1-alpha
8+
49
* Fix v2 show result if empty result.
510

611
## v0.3.0-alpha
12+
713
* Deprecated metadata json format.
814
* Removed `TransactionAsyncMetadataResponse` model.
915
* Added support to metadata protobuf format.
1016
* `GetTransactionMetadata` returns protobuf metadata.
1117
* Added `v2` show result functionality.
1218

1319
## v0.2.1
20+
1421
* Renamed:
15-
- `Execute` to `ExecuteV1`.
16-
- `ExecuteAsyncWait` to `Execute`.
22+
* `Execute` to `ExecuteV1`.
23+
* `ExecuteAsyncWait` to `Execute`.
1724

1825
## v0.2.0
26+
1927
* Added `CancelTransaction` feature.
2028

2129
## v0.1.1
2230

2331
* Added v2 predefined results formats:
24-
- `GetTransactions` returns `TransactionsAsyncMultipleResponses`.
25-
- `GetTransaction` returns `TransactionAsyncSingleResponse`.
26-
- `GetTransactionResults` returns `[]ArrowRelation`.
27-
- `GetTransactionMetadata` returns `[]TransactionAsyncMetadataResponse`.
28-
- `GetTransactionProblems` returns `[](ClientProblem|IntegrityConstraintViolation)`.
29-
- `ExecuteAsync` returns `TransactionAsyncResult`.
32+
* `GetTransactions` returns `TransactionsAsyncMultipleResponses`.
33+
* `GetTransaction` returns `TransactionAsyncSingleResponse`.
34+
* `GetTransactionResults` returns `[]ArrowRelation`.
35+
* `GetTransactionMetadata` returns `[]TransactionAsyncMetadataResponse`.
36+
* `GetTransactionProblems` returns `[](ClientProblem|IntegrityConstraintViolation)`.
37+
* `ExecuteAsync` returns `TransactionAsyncResult`.
3038

3139
* `Problem` model is changed to `ClientProblem` and `IntegrityConstraintViolation`
3240
problem type is introduced.
@@ -37,4 +45,5 @@ problem type is introduced.
3745
is a simplification and *breaking change* to the signatures of both functions.
3846

3947
## v0.1.0-alpha
48+
4049
* Initial release

README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ The RelationalAI Software Development Kit for Go enables developers to access th
1616

1717
### Requirements
1818

19-
* Go 1.17+
20-
21-
The SDK has been tested on golang version 1.17+, but likely works with earlier versions.
19+
* Go 1.18+
2220

2321
### Building the SDK
2422

@@ -29,9 +27,8 @@ The SDK has been tested on golang version 1.17+, but likely works with earlier v
2927

3028
**Run the tests**
3129

32-
cd ./rai
33-
go test
34-
30+
./run-tests
31+
3532
Note, the test are run against the account configured in your SDK config file.
3633

3734
### Create a configuration file
@@ -58,11 +55,9 @@ You can copy `config.spec` from the root of this repo and modify as needed.
5855

5956
## Generate golang sources from protobuf specification
6057

61-
```shell
62-
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
63-
export PATH=$PATH:$HOME/go/bin
64-
protoc -I protos --go_out=. --go_opt=Mschema.proto=./rai/pb --go_opt=Mmessage.proto=./rai/pb protos/*.proto
65-
```
58+
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
59+
export PATH=$PATH:$HOME/go/bin
60+
protoc -I protos --go_out=. --go_opt=Mschema.proto=./rai/pb --go_opt=Mmessage.proto=./rai/pb protos/*.proto
6661

6762
## Examples
6863

@@ -71,8 +66,8 @@ are located in `./examples` folder.
7166

7267
Each example can be run using the `go` command.
7368

74-
cd ./examples
75-
go run get_database/main.go -d sdk-test
69+
cd ./examples
70+
go run get_database/main.go -d sdk-test
7671

7772
There is also a bash script in `./examples` that can be used to run
7873
individual examples.
@@ -93,4 +88,4 @@ to submit an issue or a PR here.
9388

9489
The RelationalAI Software Development Kit for Go is licensed under the
9590
Apache License 2.0. See:
96-
https://github.com/RelationalAI/rai-sdk-go/blob/master/LICENSE
91+
https://github.com/RelationalAI/rai-sdk-go/blob/master/LICENSE

examples/cancel_transaction/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func run(opts *Options) error {
3636
if err != nil {
3737
return err
3838
}
39-
rai.Print(rsp, 4)
39+
rai.ShowJSON(rsp, 4)
4040
return nil
4141
}
4242

examples/clone_database/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func run(opts *Options) error {
3737
if err != nil {
3838
return err
3939
}
40-
rai.Print(rsp, 4)
40+
rai.ShowJSON(rsp, 4)
4141
return nil
4242
}
4343

examples/create_database/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func run(opts *Options) error {
3636
if err != nil {
3737
return err
3838
}
39-
rai.Print(rsp, 4)
39+
rai.ShowJSON(rsp, 4)
4040
return nil
4141
}
4242

examples/create_engine/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func run(opts *Options) error {
3737
if err != nil {
3838
return err
3939
}
40-
rai.Print(rsp, 4)
40+
rai.ShowJSON(rsp, 4)
4141
return nil
4242
}
4343

examples/create_oauth_client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func run(opts *Options) error {
3737
if err != nil {
3838
return err
3939
}
40-
rai.Print(rsp, 4)
40+
rai.ShowJSON(rsp, 4)
4141
return nil
4242
}
4343

examples/create_user/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func run(opts *Options) error {
3737
if err != nil {
3838
return err
3939
}
40-
rai.Print(rsp, 4)
40+
rai.ShowJSON(rsp, 4)
4141
return nil
4242
}
4343

examples/delete_model/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func run(opts *Options) error {
3838
if err != nil {
3939
return err
4040
}
41-
rai.Print(rsp, 4)
41+
rai.ShowJSON(rsp, 4)
4242
return nil
4343
}
4444

0 commit comments

Comments
 (0)