You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can see, MySQL.load does not use any information about column names and I think this can lead to bad behaviour, see for example:
using MySQL
using DataFrames
conn = DBInterface.connect(
MySQL.Connection,
...
)
df1 =DataFrame(x = [1], y = [2])
MySQL.load(df1, conn, "test")
df2 =DataFrame(y = [3], x = [4])
MySQL.load(df2, conn, "test", createtableclause ="#")
DataFrame(DBInterface.execute(conn, "select * from test"))
# =># 2×2 DataFrame# Row │ x y# │ Int64? Int64?# ─────┼────────────────# 1 │ 1 2# 2 │ 3 4
df3 =DataFrame(foo = [5], bar = [6])
MySQL.load(df3, conn, "test", createtableclause ="#")
DataFrame(DBInterface.execute(conn, "select * from test"))
# =># 3×2 DataFrame# Row │ x y# │ Int64? Int64?# ─────┼────────────────# 1 │ 1 2# 2 │ 3 4# 3 │ 5 6
so if someone accidentally gets the columns in a different order from the ones on the DB, or even has completely different column names, the (very likely wrong) data will still be appended to the table.
I think it would be great if MySQL.load could match up the input column names with those on the DB, and throw an error in the case it is not possible.
If there is some other way to ensure this, or if I can help at all - please let me know.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
As far as I can see,
MySQL.load
does not use any information about column names and I think this can lead to bad behaviour, see for example:so if someone accidentally gets the columns in a different order from the ones on the DB, or even has completely different column names, the (very likely wrong) data will still be appended to the table.
I think it would be great if
MySQL.load
could match up the input column names with those on the DB, and throw an error in the case it is not possible.If there is some other way to ensure this, or if I can help at all - please let me know.
Thanks!
The text was updated successfully, but these errors were encountered: