Skip to content

Instantly share code, notes, and snippets.

@alstat
Last active July 5, 2019 03:15
stmt = MySQL.Stmt(con,
"INSERT INTO nycflights VALUES (" *
join(repeat(["?"], inner = length(names(data)) - 1), ", ") *
");"
);
stmt
#> MySQL.Stmt(Ptr{Nothing} @0x00007f80fdb495f0, "INSERT INTO nycflights VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", 19, 0)
@time for i in 1:nrow(data)
@info("processing row " * string(i))
MySQL.execute!(stmt, Vector(data[1, names(data)[2:end]]))
end
# 219.653593 seconds (52.89 M allocations: 3.547 GiB, 0.46% gc time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment