You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by cu...@apache.org on 2024/01/11 19:32:59 UTC

(arrow-adbc) branch main updated: refactor(csharp/test/Drivers/Interop/Snowflake): Updated the metadata tests to work without the db name (#1352)

This is an automated email from the ASF dual-hosted git repository.

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new abb758cb refactor(csharp/test/Drivers/Interop/Snowflake): Updated the metadata tests to work without the db name (#1352)
abb758cb is described below

commit abb758cb33b9bf1a8eb07c6aab69c9be4f273dc6
Author: Ryan Syed <sy...@icloud.com>
AuthorDate: Thu Jan 11 11:32:53 2024 -0800

    refactor(csharp/test/Drivers/Interop/Snowflake): Updated the metadata tests to work without the db name (#1352)
    
    Changes:
    * Modified tests to check the table type returned in `DriverTests.cs`
    * The database and schema name is not required for the getting the
    metadata anymore. The metadata calls in the Driver prefix the specific
    DB name whose INFORMATION_SCHEMA tables need to be accessed.
---
 csharp/test/Drivers/Interop/Snowflake/DriverTests.cs | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/csharp/test/Drivers/Interop/Snowflake/DriverTests.cs b/csharp/test/Drivers/Interop/Snowflake/DriverTests.cs
index 55535be6..fff57233 100644
--- a/csharp/test/Drivers/Interop/Snowflake/DriverTests.cs
+++ b/csharp/test/Drivers/Interop/Snowflake/DriverTests.cs
@@ -83,12 +83,6 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake
             Dictionary<string, string> options = new Dictionary<string, string>();
             _snowflakeDriver = SnowflakeTestingUtils.GetSnowflakeAdbcDriver(_testConfiguration, out parameters);
 
-            string databaseName = _testConfiguration.Metadata.Catalog;
-            string schemaName = _testConfiguration.Metadata.Schema;
-
-            parameters[SnowflakeParameters.DATABASE] = databaseName;
-            parameters[SnowflakeParameters.SCHEMA] = schemaName;
-
             _database = _snowflakeDriver.Open(parameters);
             _connection = _database.Connect(options);
         }
@@ -212,7 +206,7 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake
             string tableName = _testConfiguration.Metadata.Table;
 
             using IArrowArrayStream stream = _connection.GetObjects(
-                    depth: AdbcConnection.GetObjectsDepth.All,
+                    depth: AdbcConnection.GetObjectsDepth.Tables,
                     catalogPattern: databaseName,
                     dbSchemaPattern: schemaName,
                     tableNamePattern: tableNamePattern,
@@ -233,6 +227,7 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake
 
             AdbcTable table = tables.Where((table) => string.Equals(table.Name, tableName)).FirstOrDefault();
             Assert.True(table != null, "table should not be null");
+            Assert.Equal("BASE TABLE", table.Type);
         }
 
         /// <summary>
@@ -258,8 +253,7 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake
             using RecordBatch recordBatch = stream.ReadNextRecordBatchAsync().Result;
 
             List<AdbcCatalog> catalogs = GetObjectsParser.ParseCatalog(recordBatch, databaseName, schemaName);
-
-            List<AdbcColumn> columns = catalogs
+            AdbcTable table = catalogs
                 .Where(c => string.Equals(c.Name, databaseName))
                 .Select(c => c.DbSchemas)
                 .FirstOrDefault()
@@ -267,9 +261,13 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake
                 .Select(s => s.Tables)
                 .FirstOrDefault()
                 .Where(t => string.Equals(t.Name, tableName))
-                .Select(t => t.Columns)
                 .FirstOrDefault();
 
+
+            Assert.True(table != null, "table should not be null");
+            Assert.Equal("BASE TABLE", table.Type);
+            List<AdbcColumn> columns = table.Columns;
+
             Assert.True(columns != null, "Columns cannot be null");
             Assert.Equal(_testConfiguration.Metadata.ExpectedColumnCount, columns.Count);