Hello
I have a very common usage pattern for converting the output of a database query (LibPQ for example)
So something like
data = DataFrame(LibPQ.execute(pgconnection, "select column1,column2 from table1 where condition1 = true"))
This generally works quite well, except where the result of the query returns 0 rows. In that case, the schema of the resulting dataframe is not consistent with the schema of the dataframe when there are rows returned from the query
It gets returned like this
0Γ2 DataFrame
Row β schema data
β CursorScβ¦ Arrayβ¦
ββββββ΄βββββββββββββββββββ
if I want the value of column1, I get an error since that column doesnβt exist in the 0 row dataframe.
Is there a way to get the output of this query to always have the same DataFrame schema in all cases regardless of query output?
Otherwise, I always have to create a temporary dataframe and check the size before proceding to the next step.