Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
ebba922
set ConfigureAwait(false) for async calls
stephenatsembit Jan 22, 2025
27e0cc1
refactor command options, refactor naming, solidify sync/async method…
stephenatsembit Jan 28, 2025
012d71e
add sample appsettings file, remove test file
stephenatsembit Jan 28, 2025
7ad7210
remove bin and obj folders, move defaults to proper end of commandopt…
stephenatsembit Jan 30, 2025
37475b1
add unittest bin/obj, and appsettings to ignore
stephenatsembit Jan 30, 2025
5da9ccc
runnable state (renaming and test tweaks)
jeffrey-elliott Jan 31, 2025
6e14fe9
rename, .gitignore, DbId for admin tests
jeffrey-elliott Jan 31, 2025
01cd335
Merge pull request #1 from stephenatsembit/db_admin
a-random-steve Feb 1, 2025
4a09303
added ListDatabases, ListDatabasesNames and tests
jeffrey-elliott Feb 1, 2025
0044e28
turn off implicit usings to make .net462 happy
stephenatsembit Feb 1, 2025
c84088e
Merge pull request #2 from stephenatsembit/db_admin
a-random-steve Feb 1, 2025
23e7e3a
added DoesDatabaseExist by string and by guid
jeffrey-elliott Feb 6, 2025
114a373
Merge pull request #3 from stephenatsembit/db_admin
a-random-steve Feb 7, 2025
6c9e310
formatting
stephenatsembit Feb 7, 2025
6cb1cb4
todo for integration test to check for existence by name
stephenatsembit Feb 7, 2025
b4233e9
utilizing CommandOptions to affect the http calls, adding methods to …
stephenatsembit Feb 12, 2025
ae9082c
added create, drop; consistent naming
jeffrey-elliott Feb 12, 2025
de696d1
refs and formatting
jeffrey-elliott Feb 12, 2025
76d117a
spacing
jeffrey-elliott Feb 12, 2025
3f4b528
move test db name into config
stephenatsembit Feb 13, 2025
4d8614d
handle sync waitfordatabase
stephenatsembit Feb 13, 2025
0ce4e10
cleanup async methods
stephenatsembit Feb 13, 2025
d2526fa
refs and spacing
jeffrey-elliott Feb 13, 2025
ec11ccf
async delagte for CreateDatabase
jeffrey-elliott Feb 14, 2025
c775326
added DatabaseCreationOptions
jeffrey-elliott Feb 14, 2025
3024e03
remove t/s code
jeffrey-elliott Feb 14, 2025
4bd98d0
added CommandOptions
jeffrey-elliott Feb 14, 2025
d187fc1
finish handling of keyspace for database, naming adjustments
stephenatsembit Feb 17, 2025
d102ea2
Merge pull request #5 from stephenatsembit/database-admin
a-random-steve Feb 17, 2025
42e26c5
Merge commit '2334bb53b9027422e19c36f2165408c636ddc279'
stephenatsembit Feb 17, 2025
e05da62
fix merge errors
stephenatsembit Feb 17, 2025
4721ae1
additional merge issues
stephenatsembit Feb 17, 2025
3456673
beginnings of insert many
stephenatsembit Feb 20, 2025
de1ab3b
Merge branch 'collections-inserts' into collection-insert-many
stephenatsembit Feb 21, 2025
46cf764
fix merge issue
stephenatsembit Feb 21, 2025
dbb9cf6
collection.InsertMany, and initial FindOne and FindMany implementations
stephenatsembit Mar 5, 2025
ec14f98
FindOne fixes
stephenatsembit Mar 5, 2025
c211213
finish initial draft of querying single and multiple documents
stephenatsembit Mar 24, 2025
c27bf7a
Merge pull request #6 from stephenatsembit/collection-insert-many
a-random-steve Mar 24, 2025
1171300
Merge branch 'datastax:main' into main
a-random-steve Mar 24, 2025
f69bae3
DatabaseAdminAstra; tests and changes for AdminAstraDatabasesAdmin
jeffrey-elliott Mar 28, 2025
dbad808
added copyright block
jeffrey-elliott Mar 28, 2025
c2afae4
finish replace and delete
stephenatsembit Mar 28, 2025
b8aa936
misc serialization fixes, refactor findmany
stephenatsembit Mar 31, 2025
92fab72
Merge pull request #7 from stephenatsembit/admin-ltip
a-random-steve Mar 31, 2025
e013599
Merge commit '92fab728629bec78c3367bdb29d65917fa65a8a7' into collecti…
stephenatsembit Mar 31, 2025
bc3a2c7
adjust keyspace test
stephenatsembit Apr 1, 2025
b9b104f
Merge pull request #8 from stephenatsembit/collection-update
a-random-steve Apr 1, 2025
d4c0371
cleanup and add tests for distinct
stephenatsembit Apr 1, 2025
3b2ab82
Merge pull request #9 from stephenatsembit/collection-update
a-random-steve Apr 1, 2025
cfe16d7
Merge branch 'datastax:main' into main
a-random-steve Apr 10, 2025
f5bacde
initial documentation setup
stephenatsembit Apr 2, 2025
5f12dc6
doc testing
stephenatsembit Apr 2, 2025
c3ee6ea
adding client documentation as well as a few additional overloads
stephenatsembit Apr 2, 2025
cb797f7
finalized admin docfx comments
jeffrey-elliott Apr 3, 2025
2ee4f63
documentation and cleanup
stephenatsembit Apr 9, 2025
536ae5c
wrap examples with code element
stephenatsembit Apr 9, 2025
d665553
Merge branch 'datastax:main' into main
a-random-steve Apr 11, 2025
2528909
fix logo in documentation to work for light and dark mode
stephenatsembit Apr 11, 2025
c7aace8
added elements for nuget package
jeffrey-elliott Apr 11, 2025
c5f23f0
Merge pull request #10 from a-random-steve/adding-nuget
a-random-steve Apr 11, 2025
a42c6af
add copyright
stephenatsembit Apr 11, 2025
148b59c
update description, remove product
stephenatsembit Apr 11, 2025
8ebce2f
fix bug where deserialization of typed object doesn't account for jso…
stephenatsembit Apr 18, 2025
87b0b0b
update readme path for nuget
stephenatsembit Apr 28, 2025
c1b07f5
default id fixes (when creating collection from a strongly-typed obje…
stephenatsembit Apr 29, 2025
a764509
Merge branch 'upstream-main'
stephenatsembit Apr 29, 2025
d602ed0
fixes for null DocumentId properties
stephenatsembit Apr 29, 2025
e2f069e
Merge branch 'datastax:main' into main
a-random-steve Apr 29, 2025
ca54836
adding table functionality
stephenatsembit Apr 25, 2025
223f19b
added listing and creating indexes on tables
jeffrey-elliott May 7, 2025
a58f9e6
table find, insert, delete
stephenatsembit May 8, 2025
fa8c89d
create index mods after merge
stephenatsembit May 8, 2025
7f54f18
added alter table operations
jeffrey-elliott May 15, 2025
4b0a622
Merge pull request #11 from a-random-steve/alter-table
a-random-steve May 19, 2025
6f29963
misc fixes for tables as well as some collection deserialization fixe…
stephenatsembit May 19, 2025
8ec93d6
finish functionality for beta release of tables functionality
stephenatsembit May 20, 2025
390919c
cleanup and fixes
stephenatsembit May 22, 2025
e8161b0
Merge branch 'datastax:main' into main
a-random-steve May 22, 2025
3710f47
Merge branch 'main' into tables
stephenatsembit May 22, 2025
03a0860
Remove ability to get database by id, add waitForCompletion option to…
stephenatsembit Jun 13, 2025
9b92bc0
update admin test
stephenatsembit Jun 13, 2025
f90ddb9
Finish draft of hybrid search, improvements to find enumerators, upda…
stephenatsembit Jun 24, 2025
b014ff3
remove test run files
stephenatsembit Jun 24, 2025
3aa1a41
add upgrade info to readme
stephenatsembit Jun 24, 2025
a3011db
initial github action
stephenatsembit Jun 24, 2025
2b8dece
update build path
stephenatsembit Jun 24, 2025
a2f66ec
update build path
stephenatsembit Jun 24, 2025
8154a68
fix build path
stephenatsembit Jun 24, 2025
3a44bc1
add dry run release ci
stephenatsembit Jun 24, 2025
9cc4de1
fix yaml syntax
stephenatsembit Jun 24, 2025
29953ff
change tag processing
stephenatsembit Jun 24, 2025
4fa38d3
Update release.yml
a-random-steve Jun 24, 2025
43849e5
remove version from csproj as it will be passed in by the ci/cd action
stephenatsembit Jun 24, 2025
6596132
cleanup
stephenatsembit Jun 25, 2025
4737e60
updated databaseinfo objects
stephenatsembit Jun 25, 2025
78aeaa9
Merge branch 'upstream-main'
stephenatsembit Jun 25, 2025
69cfc64
merge cleanup
stephenatsembit Jun 25, 2025
b3f12cc
Merge branch 'main' into client-team-feedback
stephenatsembit Jun 25, 2025
b739299
remove DeleteAll, simplify DatabaseInfo, add missing property to Vect…
stephenatsembit Jun 26, 2025
5085fb5
handle multiple types and levels of timeouts, fixes for untyped tables
stephenatsembit Jul 1, 2025
de0becd
code cleanup and refactoring
stephenatsembit Jul 1, 2025
03571e9
refactor integration tests, fix database creation options
stephenatsembit Jul 3, 2025
d1e0788
Merge branch 'datastax:main' into main
a-random-steve Jul 8, 2025
5c58942
Merge commit 'd1e078886a1a0fd84f6e68770e89c416bf663fe9' into client-t…
stephenatsembit Jul 8, 2025
fe18671
remove dry run for automated nuget build
stephenatsembit Jul 8, 2025
6a3b9ee
changes based on feedback during documentation
stephenatsembit Sep 16, 2025
336d426
additional cleanup and hardening per documentation feedback
stephenatsembit Sep 17, 2025
46beeef
limit parallelization on tests (to avoid limits)
stephenatsembit Sep 17, 2025
78b76b7
add ability to handle lexical sort/filter for collections
stephenatsembit Sep 18, 2025
1c52d16
rework tablesort, rework tableindexes (adding text index for lexical)…
stephenatsembit Sep 22, 2025
fd1797c
user defined types
stephenatsembit Oct 28, 2025
021a257
fixes
stephenatsembit Oct 29, 2025
250e48a
Merge commit '32c7cda7ea66b308a541f9cab9f14de7c7550a46'
stephenatsembit Nov 13, 2025
a959d05
Merge branch 'main' into user-defined-types
stephenatsembit Nov 13, 2025
1802e46
finishing udt's and tests
stephenatsembit Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 74 additions & 27 deletions src/DataStax.AstraDB.DataApi/Admin/AstraDatabasesAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,39 @@ public async Task<List<string>> ListDatabaseNamesAsync(CommandOptions options)
}

/// <summary>
/// Returns a list of database info objects.
/// Synchronous version of <see cref="ListDatabasesAsync()"/>
/// </summary>
/// <returns>A list of DatabaseInfo objects.</returns>
/// <example>
/// <code>
/// var databases = admin.ListDatabases();
/// </code>
/// </example>
/// <inheritdoc cref="ListDatabasesAsync()"/>
public List<DatabaseInfo> ListDatabases()
{
return ListDatabasesAsync(null, true).ResultSync();
return ListDatabases(null, null);
}

/// <summary>
/// Synchronous version of <see cref="ListDatabasesAsync(CommandOptions)"/>
/// </summary>
/// <inheritdoc cref="ListDatabasesAsync(CommandOptions)"/>
public List<DatabaseInfo> ListDatabases(CommandOptions options)
{
return ListDatabases(null, options);
}

/// <summary>
/// Synchronous version of <see cref="ListDatabasesAsync(ListDatabaseOptions)"/>
/// </summary>
/// <inheritdoc cref="ListDatabasesAsync(ListDatabaseOptions)"/>
public List<DatabaseInfo> ListDatabases(ListDatabaseOptions listOptions)
{
return ListDatabases(listOptions, null);
}

/// <summary>
/// Synchronous version of <see cref="ListDatabasesAsync(ListDatabaseOptions, CommandOptions)"/>
/// </summary>
/// <inheritdoc cref="ListDatabasesAsync(ListDatabaseOptions, CommandOptions)"/>
public List<DatabaseInfo> ListDatabases(ListDatabaseOptions listOptions, CommandOptions options)
{
return ListDatabasesAsync(null, options, true).ResultSync();
}

/// <summary>
Expand All @@ -130,44 +152,56 @@ public List<DatabaseInfo> ListDatabases()
/// </example>
public Task<List<DatabaseInfo>> ListDatabasesAsync()
{
return ListDatabasesAsync(null, false);
return ListDatabasesAsync(null, null);
}

/// <summary>
/// Returns a list of database info objects using specified command options.
/// Asynchronously returns a list of database info objects using specified command options.
/// </summary>
/// <param name="options">The command options to use.</param>
/// <returns>A list of DatabaseInfo objects.</returns>
/// <returns>A task that resolves to a list of DatabaseInfo objects.</returns>
/// <example>
/// <code>
/// var databases = admin.ListDatabases(options);
/// var databases = await admin.ListDatabasesAsync(options);
/// </code>
/// </example>
public List<DatabaseInfo> ListDatabases(CommandOptions options)
public Task<List<DatabaseInfo>> ListDatabasesAsync(CommandOptions options)
{
return ListDatabasesAsync(options, true).ResultSync();
return ListDatabasesAsync(null, options, false);
}

/// <summary>
/// Asynchronously returns a list of database info objects using specified command options.
/// Asynchronously returns a list of database info objects using specified filtering options
/// </summary>
/// <param name="options">The command options to use.</param>
/// <returns>A task that resolves to a list of DatabaseInfo objects.</returns>
/// <example>
/// <code>
/// var databases = await admin.ListDatabasesAsync(options);
/// </code>
/// </example>
public Task<List<DatabaseInfo>> ListDatabasesAsync(CommandOptions options)
/// <param name="listOptions"></param>
/// <returns></returns>
public Task<List<DatabaseInfo>> ListDatabasesAsync(ListDatabaseOptions listOptions)
{
return ListDatabasesAsync(options, false);
return ListDatabasesAsync(listOptions, null, false);
}

internal async Task<List<DatabaseInfo>> ListDatabasesAsync(CommandOptions options, bool runSynchronously)
/// <summary>
/// Asynchronously returns a list of database info objects using specified command options and filtering options
/// </summary>
/// <param name="options"></param>
/// <param name="listOptions"></param>
/// <returns></returns>
public Task<List<DatabaseInfo>> ListDatabasesAsync(ListDatabaseOptions listOptions, CommandOptions options)
{
return ListDatabasesAsync(listOptions, options, false);
}

internal async Task<List<DatabaseInfo>> ListDatabasesAsync(ListDatabaseOptions listOptions, CommandOptions options, bool runSynchronously)
{
if (listOptions == null)
{
listOptions = new ListDatabaseOptions();
}

var command = CreateCommand()
.AddUrlPath("databases")
.WithTimeoutManager(new DatabaseAdminTimeoutManager())
.WithPayload(listOptions)
.AddCommandOptions(options);

var rawResults = await command.RunAsyncRaw<List<RawDatabaseInfo>>(HttpMethod.Get, runSynchronously).ConfigureAwait(false);
Expand Down Expand Up @@ -349,7 +383,7 @@ internal async Task<IDatabaseAdmin> CreateDatabaseAsync(DatabaseCreationOptions
var databaseName = creationOptions.Name;
Guard.NotNullOrEmpty(databaseName, nameof(databaseName));

List<DatabaseInfo> dbList = await ListDatabasesAsync(commandOptions, runSynchronously).ConfigureAwait(false);
List<DatabaseInfo> dbList = await ListDatabasesAsync(null, commandOptions, runSynchronously).ConfigureAwait(false);

DatabaseInfo existingDb = dbList.FirstOrDefault(item => databaseName.Equals(item.Name));

Expand Down Expand Up @@ -568,7 +602,7 @@ public Task<bool> DropDatabaseAsync(Guid dbGuid, CommandOptions options)
internal async Task<bool> DropDatabaseAsync(string databaseName, CommandOptions options, bool runSynchronously)
{
Guard.NotNullOrEmpty(databaseName, nameof(databaseName));
var dbList = await ListDatabasesAsync(options, runSynchronously).ConfigureAwait(false);
var dbList = await ListDatabasesAsync(null, options, runSynchronously).ConfigureAwait(false);

var dbInfo = dbList.FirstOrDefault(item => item.Name.Equals(databaseName));
if (dbInfo == null)
Expand Down Expand Up @@ -604,6 +638,19 @@ internal async Task<bool> DropDatabaseAsync(Guid dbGuid, CommandOptions options,
return false;
}


/// <summary>
/// Returns an IDatabaseAdmin instance for the database at the specified URL.
/// </summary>
/// <param name="dbUrl"></param>
/// <returns></returns>
public IDatabaseAdmin GetDatabaseAdmin(string dbUrl)
{
var database = _client.GetDatabase(dbUrl);
return new DatabaseAdminAstra(database, _client, null);
}


/// <summary>
/// Retrieves database information for the specified GUID.
/// </summary>
Expand Down
5 changes: 4 additions & 1 deletion src/DataStax.AstraDB.DataApi/Admin/DatabaseAdminAstra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ public Task DropKeyspaceAsync(string keyspace)
}

/// <inheritdoc cref="DropKeyspaceAsync(string)"/>
/// <param name="keyspace"></param>
/// <param name="waitForCompletion">Whether or not to wait for the keyspace to be dropped before returning.</param>
/// <example>
/// <code>
Expand All @@ -405,8 +406,8 @@ public Task DropKeyspaceAsync(string keyspace, bool waitForCompletion)
}

/// <inheritdoc cref="DropKeyspaceAsync(string)"/>
/// <param name="keyspace"></param>
/// <param name="options">Optional settings that influence request execution.</param>

/// <example>
/// <code>
/// await admin.DropKeyspaceAsync("myKeyspace", options);
Expand All @@ -422,7 +423,9 @@ public Task DropKeyspaceAsync(string keyspace, CommandOptions options)
}

/// <inheritdoc cref="DropKeyspaceAsync(string, CommandOptions)"/>
/// <param name="keyspace"></param>
/// <param name="waitForCompletion">Whether or not to wait for the keyspace to be dropped before returning.</param>
/// <param name="options"></param>
/// <example>
/// <code>
/// await admin.DropKeyspaceAsync("myKeyspace", true, options);
Expand Down
6 changes: 3 additions & 3 deletions src/DataStax.AstraDB.DataApi/Admin/DatabaseCreationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class DatabaseCreationOptions
public string Keyspace { get; set; } = Database.DefaultKeyspace;

[JsonPropertyName("capacityUnits")]
public int CapacityUnits { get; set; } = 1;
internal int CapacityUnits { get; set; } = 1;

[JsonPropertyName("tier")]
public string Tier { get; set; } = "serverless";
internal string Tier { get; set; } = "serverless";

[JsonPropertyName("dbType")]
public string DatabaseType { get; set; } = "vector";
internal string DatabaseType { get; set; } = "vector";
}
79 changes: 79 additions & 0 deletions src/DataStax.AstraDB.DataApi/Admin/ListDatabaseOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright DataStax, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using DataStax.AstraDB.DataApi.Core;
using System.Text.Json.Serialization;

namespace DataStax.AstraDB.DataApi.Admin;

/// <summary>
/// Options used for ListDatabasesAsync.
/// </summary>
public class ListDatabaseOptions
{
/// <summary>
/// Filter databases based on specific states.
/// </summary>
[JsonPropertyName("include")]
public QueryDatabaseStates StatesToInclude { get; set; } = QueryDatabaseStates.nonterminated;

/// <summary>
/// Filter databases based on cloud provider.
/// </summary>
[JsonPropertyName("cloudProvider")]
public QueryCloudProvider Provider { get; set; } = QueryCloudProvider.ALL;

/// <summary>
/// See <see cref="PageSizeLimit"/>. If getting an additional page of data, pass in the id of the last database in the previous page.
/// </summary>
[JsonPropertyName("starting_after")]
internal string StartingAfter { get; set; }

/// <summary>
/// Number of items to return "per page".
/// </summary>
[JsonPropertyName("limit")]
public int PageSizeLimit = 100;
}

public enum QueryDatabaseStates
{
nonterminated,
all,
active,
pending,
preparing,
prepared,
initializing,
parked,
parking,
unparking,
terminating,
terminated,
resizing,
error,
maintenance,
suspended,
suspending
}

public enum QueryCloudProvider
{
ALL,
AWS,
GCP,
AZURE
}
Loading
Loading