Skip to content

Commit

Permalink
Metadata info protobuf format support (#8)
Browse files Browse the repository at this point in the history
* adding support to metadata info protobuf format

* Revert "adding support to metadata info protobuf format"

This reverts commit 48dbdfa.

* adding support to metadata info protobuf format

* cleanup

* proto update

* Added get transaction protobuf metadata

* formatting

* cleanup

* fix

* fix metadata.pb path

* fixing relation id in ExecAsync test

* remove output type from Proto project

* remove internal server proto file

* support also osx

* GetTransactionMetadataInfo to GetTransactionMetadata

* adding metadata.pb.txt

* updated changelog && bump up version

* fix metadata proto test issue

* code formatting using dotnet format

* new lines added

* linter check added

* simulate bad written code

* fix dotner command

* fix lint issue

* apply styling

* fix linting

* fix test
  • Loading branch information
NRHelmi authored Aug 21, 2022
1 parent d88cabd commit 490cbdf
Show file tree
Hide file tree
Showing 45 changed files with 3,705 additions and 259 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/dotnet-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
- name: Build
run: dotnet build

- name: Dotnet linter
run: |
dotnet tool install -g dotnet-format
dotnet format . --check
- name: Test
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ RelationalAI.Test/bin
RelationalAI.Test/obj
RelationalAI.Examples/bin
RelationalAI.Examples/obj
RelationalAI.Protos/bin
RelationalAI.Protos/obj
RelationalAI/bin
RelationalAI/obj
launch.json
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.6.0-alpha
* Deprecated metadata json format.
* Removed `TransactionAsyncMetadataResponse` model.
* Added support to metadata protobuf format.
* `GetTransactionMetadata` returns protobuf metadata.

## v0.5.0-alpha
* In this update we ensure the SDK follows the standard async/await approach for the methods. The following methods have been renamed to include the "Async" postfix, made async and now return a `Task<T>` to the user:
- `CreateDatabase`, `GetDatabase`, `ListDatabases`, `DeleteDatabase`, `CloneDatabase`.
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/CreateDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static async Task Run(string database, string engine, string profile = "
Dictionary<string, object> config = Config.Read("", profile);
Client.Context context = new Client.Context(config);
Client client = new Client(context);
Console.WriteLine("Creating Database: "+ database);
Console.WriteLine("Creating Database: " + database);
Console.WriteLine(await client.CreateDatabaseAsync(database, engine));
}

Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/CreateEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static async Task Run(string engine, string profile = "default")
Dictionary<string, object> config = Config.Read("", profile);
Client.Context context = new Client.Context(config);
Client client = new Client(context);
Console.WriteLine("Creating Engine: "+ engine);
Console.WriteLine("Creating Engine: " + engine);
Console.WriteLine(await client.CreateEngineWaitAsync(engine));
}

Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/DeleteOAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace RelationalAI.Examples
{
public class DeleteOAuthClient
{
{
public static Command GetCommand()
{
var cmd = new Command("DeleteOAuthClient", "--id <Client ID> --profile <Profile name>"){
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/GetOAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace RelationalAI.Examples
{
public class GetOAuthClient
{
{
public static Command GetCommand()
{
var cmd = new Command("GetOAuthClient", "--id <Client ID> --profile <Profile name>"){
Expand Down
12 changes: 5 additions & 7 deletions RelationalAI.Examples/GetTransactionMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.NamingConventionBinder;
Expand All @@ -21,7 +21,7 @@ public static Command GetCommand()
Description = "Profile name from .rai/config to connect to RAI Cloud."
}
};
cmd.Description = "Get an asynchronous transaction metadata.";
cmd.Description = "Get an asynchronous transaction protobuf metadata.";
cmd.Handler = CommandHandler.Create<string, string>(Run);
return cmd;
}
Expand All @@ -31,11 +31,9 @@ private static async Task Run(string id, string profile = "default")
Dictionary<string, object> config = Config.Read("", profile);
Client.Context context = new Client.Context(config);
Client client = new Client(context);
var metadataList = await client.GetTransactionMetadataAsync(id);
foreach(var metadata in metadataList)
{
Console.WriteLine(metadata);
}

var metadata = await client.GetTransactionMetadataAsync(id);
Console.WriteLine(metadata);
}
}
}
2 changes: 1 addition & 1 deletion RelationalAI.Examples/GetTransactionProblems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static async Task Run(string id, string profile = "default")
Client.Context context = new Client.Context(config);
Client client = new Client(context);
var problems = await client.GetTransactionProblemsAsync(id);
foreach(var problem in problems)
foreach (var problem in problems)
{
Console.WriteLine(problem);
}
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/GetTransactionResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static async Task Run(string id, string profile = "default")
Dictionary<string, object> config = Config.Read("", profile);
Client.Context context = new Client.Context(config);
Client client = new Client(context);
foreach( var result in await client.GetTransactionResultsAsync(id))
foreach (var result in await client.GetTransactionResultsAsync(id))
{
Console.WriteLine(result);
}
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/GetTransactions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static async Task Run(string id, string profile = "default")
Client.Context context = new Client.Context(config);
Client client = new Client(context);
var transactions = await client.GetTransactionsAsync();
foreach(var transaction in transactions.Transactions)
foreach (var transaction in transactions.Transactions)
{
Console.WriteLine(transaction);
}
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/ListDatabases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private static async Task Run(string state = null, string profile = "default")
Client.Context context = new Client.Context(config);
Client client = new Client(context);
List<Database> databases = await client.ListDatabasesAsync(state);
foreach(var database in databases)
foreach (var database in databases)
{
Console.WriteLine(database);
}
Expand Down
6 changes: 3 additions & 3 deletions RelationalAI.Examples/ListEngines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ private static async Task Run(string state = null, string profile = "default")
Client.Context context = new Client.Context(config);
Client client = new Client(context);
List<Engine> engines = await client.ListEnginesAsync(state);
foreach(var engine in engines)
foreach (var engine in engines)
{
Console.WriteLine(engine.ToString(true));
}
}

}

}
Expand Down
2 changes: 1 addition & 1 deletion RelationalAI.Examples/ListUsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private static async Task Run(string profile = "default")
Client.Context context = new Client.Context(config);
Client client = new Client(context);
List<User> users = await client.ListUsersAsync();
foreach(var user in users)
foreach (var user in users)
{
Console.WriteLine(user.ToString(true));
}
Expand Down
Loading

0 comments on commit 490cbdf

Please sign in to comment.