I have pulled data from an Oracle database using JDBC
and collected the results using the following code:
oracle_cursor = JDBC.cursor(oracle_connection)
execute!(oracle_cursor, "SQL STATEMENT")
column_names = map(x -> Symbol(x), JDBC.colnames(JDBC.Source(oracle_cursor)))
advstand_data = JuliaDB.table(collect(JDBC.rows(oracle_cursor)))
The resulting JuliaDB is Tuple{String,Union{Missing, String},String,String,Float32}
which is not a Named Tuple and has colnames(advstand_data) = (1, 2, 3, 4, 5)
. I am trying to use JuliaDB.renamecol
to change the column names.
The following code does not change the column name:
advstand_data = renamecol(advstand_data, colnames(advstand_data)[1], :COLUMN_1)
The following code has the following error:
ERROR: 1 not found. Cannot rename it.
Stacktrace:
[1] rename!(::ColDict{IndexedTable{StructArray{Tuple{String,Union{Missing, String},String,String,Float32},1,NamedTuple{(:x1, :x2, :x3, :x4, :x5),Tuple{WeakRefStrings.StringArray{String,1},WeakRefStrings.StringArray{Union{Missing, String},1},WeakRefStrings.StringArray{String,1},WeakRefStrings.StringArray{String,1},Array{Float32,1}}}}}}, ::Symbol, ::Symbol) at C:\Users\jmbyars\.julia\packages\IndexedTables\DgX0A\src\columns.jl:471
[2] renamecol(::IndexedTable{StructArray{Tuple{String,Union{Missing, String},String,String,Float32},1,NamedTuple{(:x1, :x2, :x3, :x4, :x5),Tuple{WeakRefStrings.StringArray{String,1},WeakRefStrings.StringArray{Union{Missing, String},1},WeakRefStrings.StringArray{String,1},WeakRefStrings.StringArray{String,1},Array{Float32,1}}}}}, ::Symbol, ::Vararg{Symbol,N} where N) at C:\Users\jmbyars\.julia\packages\IndexedTables\DgX0A\src\columns.jl:505
[3] top-level scope at none:0
Is there any recommendations on fixing the column names?