I’m using DBInterface and MySQL to interact with my MySQL database, but my function is stucking into a strange error.
This function below works well, but is slow and inefficient:
function insertNewDebDataIntoDatabase(df::DataFrame)
conn::DBInterface.Connection = getConnection()
for row in eachrow(df)
query = DBInterface.prepare(
conn,
"INSERT INTO DebSchedule ..."
)
DBInterface.execute(
query, [
row[:RptDt],...])
DBInterface.close!(query)
end
end
But this below doesn’t work:
function insertNewDebDataIntoDatabase(df::DataFrame)
conn::DBInterface.Connection = getConnection()
query = DBInterface.prepare(
conn,
"INSERT INTO DebSchedule ..."
)
for row in eachrow(df)
DBInterface.execute(
query, [
row[:RptDt],...])
end
DBInterface.close!(query)
end
This throws ERROR: UndefRefError: access to undefined reference
.
I don’t see why the difference between them could be a problem.