Skip to content

Commit 745d8e8

Browse files
committed
adding close_database
1 parent 5a722f7 commit 745d8e8

File tree

8 files changed

+32
-13
lines changed

8 files changed

+32
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a Client SDK for RelationalAI
44

5-
- API version: 1.2.4
5+
- API version: 1.2.5
66

77
## Frameworks supported
88

RelationalAI/Connection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ public bool EnableLibrary(string srcName)
364364
return Client.EnableLibrary(srcName);
365365
}
366366

367+
public bool CloseDatabase()
368+
{
369+
SetConnectionOnClients();
370+
return Client.CloseDatabase();
371+
}
372+
367373
public ICollection<Relation> Cardinality(string relName = null)
368374
{
369375
SetConnectionOnClients();

RelationalAI/GeneratedRelationalAIClient.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ public System.Collections.Generic.IDictionary<string, object> AdditionalProperti
842842
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.24.0 (Newtonsoft.Json v12.0.0.0)")]
843843
public partial class ModifyWorkspaceAction : Action
844844
{
845+
[Newtonsoft.Json.JsonProperty("close_database", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
846+
public string Close_database { get; set; }
847+
845848
[Newtonsoft.Json.JsonProperty("delete_edb", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
846849
public string Delete_edb { get; set; }
847850

@@ -1838,9 +1841,6 @@ public partial class Transaction
18381841
[Newtonsoft.Json.JsonProperty("source_dbname", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
18391842
public string Source_dbname { get; set; }
18401843

1841-
[Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
1842-
public int? Version { get; set; }
1843-
18441844
[Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)]
18451845
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
18461846
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
@@ -1904,9 +1904,6 @@ public partial class TransactionResult
19041904
[Newtonsoft.Json.JsonProperty("problems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
19051905
public System.Collections.Generic.ICollection<AbstractProblem> Problems { get; set; }
19061906

1907-
[Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
1908-
public int? Version { get; set; }
1909-
19101907
[Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)]
19111908
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
19121909
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]

RelationalAI/KGMSClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class GeneratedRelationalAIClient
2121

2222
public const string JSON_CONTENT_TYPE = "application/json";
2323
public const string CSV_CONTENT_TYPE = "text/csv";
24-
public const string USER_AGENT_HEADER = "KGMSClient/1.2.4/csharp";
24+
public const string USER_AGENT_HEADER = "KGMSClient/1.2.5/csharp";
2525

2626
public int DebugLevel = Connection.DEFAULT_DEBUG_LEVEL;
2727

@@ -959,6 +959,13 @@ public bool EnableLibrary(string srcName)
959959
return RunAction(action) != null;
960960
}
961961

962+
public bool CloseDatabase()
963+
{
964+
var action = new ModifyWorkspaceAction();
965+
action.Close_database = conn.DbName;
966+
return RunAction(action, isReadOnly: true) != null;
967+
}
968+
962969
public ICollection<Relation> Cardinality(string relName = null)
963970
{
964971
var action = new CardinalityAction();

RelationalAI/RelationalAI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>1.2.4</Version>
4+
<Version>1.2.5</Version>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<PackageId>RelationalAI</PackageId>
77
<Authors>RelationalAI</Authors>

RelationalAISamples/LocalWorkflow.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ class LocalWorkflow
1010
public void runLocalWorkflow()
1111
{
1212
string dbname = "localcsharpdatabase";
13-
LocalConnection conn = new LocalConnection(dbname);
1413

15-
new KGMSClient(conn);
14+
IDictionary<String, String> extraHeaders = new Dictionary<String, String>();
15+
extraHeaders.Add("header-1", "value-1");
16+
extraHeaders.Add("header-2", "value-2");
17+
18+
LocalConnection conn = new LocalConnection(dbname, extraHeaders: extraHeaders);
1619

1720
conn.CreateDatabase(true);
1821

@@ -53,7 +56,7 @@ def jaccard_similarity(a,b,v) = (count[x : tmp(a,b,x)] / count[x: (uedge(a, x) o
5356
);
5457

5558
Console.WriteLine("==> Jaccard Similarity: " + JObject.FromObject(queryResult).ToString());
56-
59+
conn.CloseDatabase();
5760
}
5861
}
5962
}

RelationalAITests/IntegrationTestsCommons.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ def cityRes(x) = exists(pos: json(:address, :city, x))
314314
conn.CreateDatabase(overwrite: true);
315315
Assert.True(conn.EnableLibrary("stdlib"));
316316

317+
// close_database
318+
// =============================================================================
319+
conn = connFunc();
320+
conn.CreateDatabase(overwrite: true);
321+
Assert.True(conn.CloseDatabase());
322+
317323
// cardinality
318324
// =============================================================================
319325
conn = connFunc();

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let
99
in
1010
stdenv.mkDerivation rec {
1111
name = "rai-server-csharp-client-sdk-${version}";
12-
version = "1.2.4";
12+
version = "1.2.5";
1313
buildInputs = [
1414
raiserverBinary
1515
dotnet-sdk_3

0 commit comments

Comments
 (0)