CurtHagenlocher commented on code in PR #1865:
URL: https://github.com/apache/arrow-adbc/pull/1865#discussion_r1601743028


##########
csharp/src/Apache.Arrow.Adbc/AdbcConnection11.cs:
##########
@@ -0,0 +1,390 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Apache.Arrow.Ipc;
+
+namespace Apache.Arrow.Adbc
+{
+    /// <summary>
+    /// Provides methods for query execution, managing prepared statements,
+    /// using transactions, and so on.
+    /// </summary>
+    public abstract class AdbcConnection11 : IDisposable
+#if NET5_0_OR_GREATER
+        , IAsyncDisposable
+#endif
+    {
+        ~AdbcConnection11() => Dispose(false);
+
+        /// <summary>
+        /// Attempts to cancel an in-progress operation on a connection.
+        /// </summary>
+        /// <remarks>
+        /// This can be called during a method like GetObjects or while 
consuming an ArrowArrayStream
+        /// returned from such. Calling this function should make the other 
function throw a cancellation exception.
+        ///
+        /// This must always be thread-safe.
+        /// </remarks>
+        public virtual void Cancel()
+        {
+            throw AdbcException.NotImplemented("Connection does not support 
cancellation");
+        }
+
+        /// <summary>
+        /// Starts a new transaction with the given isolation level
+        /// </summary>
+        /// <param name="isolationLevel">The isolation level for the new 
transaction.</param>
+        public virtual void BeginTransaction(IsolationLevel? isolationLevel = 
default)
+        {
+            Task.Run(() => 
BeginTransactionAsync(isolationLevel)).GetAwaiter().GetResult();
+        }
+
+        public virtual Task BeginTransactionAsync(IsolationLevel? 
isolationLevel = default, CancellationToken cancellationToken = default)
+        {
+            throw AdbcException.NotImplemented("Connection does not support 
transactions");
+        }
+
+        /// <summary>
+        /// Create a new statement to bulk insert into a table.
+        /// </summary>
+        /// <param name="targetCatalog">The catalog name, or null to use the 
current catalog</param>
+        /// <param name="targetDbSchema">The schema name, or null to use the 
current schema</param>
+        /// <param name="targetTableName">The table name</param>
+        /// <param name="mode">The ingest mode</param>
+        /// <param name="isTemporary">True for a temporary table. Catalog and 
Schema must be null when true.</param>
+        public virtual AdbcStatement BulkIngest(string? targetCatalog, string? 
targetDbSchema, string targetTableName, BulkIngestMode mode, bool isTemporary)

Review Comment:
   All this does is setup a statement for later binding and execution. It's not 
intended to do anything on the server side. We could instead have something a 
little more complete like
   ```
   void BulkIngest(string? targetCatalog, string? targetDbSchema, string 
targetTableName, BulkIngestMode mode, bool isTemporary, IArrowArrayStream data);
   Task BulkIngestAsync(string? targetCatalog, string? targetDbSchema, string 
targetTableName, BulkIngestMode mode, bool isTemporary, IArrowArrayStream data, 
CancellationToken cancellationToken);
   ```
   and with that definition we'd obviously need an async version.
   
   There were a few reasons I chose not to do this (or not to do this now) 
including the need to have both variations (the equivalents of Bind and 
BindStream) and the longer-term desire to support the progress API which might 
then require additional overloads. But I'm definitely conflicted on the best 
thing to do for right now.
   
   That said, if CreateStatement has an async version then this would get one 
too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to