Giorgi / DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
https://duckdb.net
MIT License
339 stars 61 forks source link

Support Schema option on CreateAppender #94

Closed Chris-Barton closed 1 year ago

Chris-Barton commented 1 year ago

Hi

Could we support passing the scheme to CreateAppender()

As the native function already supports this as far as I can see a none breaking change could be done with replacing the existing methods with the following:

      public DuckDBAppender CreateAppender(string table) => CreateAppender(null, table);

      public DuckDBAppender CreateAppender(string schema, string table)
      {
          EnsureConnectionOpen();
          if (NativeMethods.Appender.DuckDBAppenderCreate(NativeConnection, schema, table, out var nativeAppender) == DuckDBState.DuckDBError)
          {
              try
              {
                  DuckDBAppender.ThrowLastError(nativeAppender);
              }
              finally
              {
                  nativeAppender.Close();
              }
          }

          return new DuckDBAppender(nativeAppender);
      }

I haven't looked at the full API but i guess there would be other places that would need to support the schema as a parameter

Giorgi commented 1 year ago

Should be an easy change. Want to send a PR?

Giorgi commented 1 year ago

Thanks for the PR