Skip to content

Commit d5c20f9

Browse files
quinnjclaude
andcommitted
Use CREATE TABLE IF NOT EXISTS when append=true, bump to v1.5.0
When append=true (the default), use CREATE TABLE IF NOT EXISTS to silently skip table creation if the table already exists. This avoids noisy warnings on subsequent loads to the same table. New features in v1.5.0: - coltypes parameter for custom column type overrides (#225) - auto_increment_primary_key_name parameter (#230) - CREATE TABLE IF NOT EXISTS for append mode - Named column inserts for better compatibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e22212e commit d5c20f9

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MySQL"
22
uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd"
33
author = ["quinnj"]
4-
version = "1.4.7"
4+
version = "1.5.0"
55

66
[deps]
77
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"

src/load.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ function load(itr, conn::Connection, name::AbstractString="mysql_"*Random.randst
8787
if quoteidentifiers
8888
name = quoteid(name)
8989
end
90+
# Use IF NOT EXISTS when appending to avoid warnings on subsequent loads
91+
createclause = append ? "CREATE TABLE IF NOT EXISTS" : "CREATE TABLE"
9092
try
91-
createtable(conn, name, sch; quoteidentifiers=quoteidentifiers, debug=debug, kw...)
93+
createtable(conn, name, sch; quoteidentifiers=quoteidentifiers, debug=debug, createtableclause=createclause, kw...)
9294
catch e
9395
@warn "error creating table" (e, catch_backtrace())
9496
end

0 commit comments

Comments
 (0)