From 4062ad8186564b4491da1c6e9d0416a5d2407472 Mon Sep 17 00:00:00 2001
From: Peter Steinbach <p.steinbach@hzdr.de>
Date: Fri, 14 Mar 2025 12:02:27 +0100
Subject: [PATCH] if append=true, createtable is skipped to avoid warning

---
 src/load.jl | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/load.jl b/src/load.jl
index c2cb869..b26bd40 100644
--- a/src/load.jl
+++ b/src/load.jl
@@ -50,9 +50,10 @@ end
 Attempts to take a Tables.jl source `table` and load into the database represented by `conn` with table name `name`.
 
 It first detects the `Tables.Schema` of the table source and generates a `CREATE TABLE` statement
-with the appropriate column names and types. If no table name is provided, one will be autogenerated, like `odbcjl_xxxxx`.
+with the appropriate column names and types. If no table name is provided, one will be autogenerated, like `mysql_xxxxx`.
 The `CREATE TABLE` clause can be provided manually by passing the `createtableclause` keyword argument, which
 would allow specifying a temporary table or `if not exists`.
+
 Column definitions can also be enhanced by providing arguments to `columnsuffix` as a `Dict` of 
 column name (given as a `Symbol`) to a string of the enhancement that will come after name and type like
 `[column name] [column type] enhancements`. This allows, for example, specifying the charset of a string column
@@ -82,12 +83,13 @@ function load(itr, conn::Connection, name::AbstractString="mysql_"*Random.randst
     if quoteidentifiers
         name = quoteid(name)
     end
-    try
-        createtable(conn, name, sch; quoteidentifiers=quoteidentifiers, debug=debug, kw...)
-    catch e
-        @warn "error creating table" (e, catch_backtrace())
-    end
+    # create table as we are not appending
     if !append
+        try
+            createtable(conn, name, sch; quoteidentifiers=quoteidentifiers, debug=debug, kw...)
+        catch e
+            @warn "error creating table" (e, catch_backtrace())
+        end
         DBInterface.execute(conn, "DELETE FROM $name")
     end
     # start a transaction for inserting rows