# MySQL Cursor

**URL:** <https://discourse.julialang.org/t/mysql-cursor/110075>\
**Category:** General Usage\
**Created:** [February 11, 2024, 6:49pm UTC](https://discourse.julialang.org/t/mysql-cursor/110075 "2024-02-11T18:49:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pino](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@Pino](https://discourse.julialang.org/u/Pino)\
**Post date:** [February 11, 2024, 6:49pm UTC](https://discourse.julialang.org/t/mysql-cursor/110075/1 "2024-02-11T18:49:20Z")

</div>

Hi,

I’m trying to loop through exsisting SQL tables to retrieve the balance at a certain report date.

```julia
query_data = "SELECT `date`, `balance` FROM $table_name"

    # Execute the query
    data = DBInterface.execute(conn, query_data)

```

so data is now a MySQL text cursor. It seems to work up to a point because it has 2 fields (date and balance) and the correct number of rows.

As a next step I’d do a pivot wit dates as index and sum balance as values.

But if I do the below I get a dataframe full of missing values

```julia
trial = DataFrame(data)

```

If I do

```julia
    current_balances = []

# Iterate through rows and extract 'Current Balance' values
for nrows in data
    push!(current_balances, nrows[1])
end

```

I get only the dates column.

How can I get the cursor to dataframe in order to complete my analysis?

Thanks
