Scalar values from sql.from results

Next up… I’m looking for help using a single record in a flux filter that was queried from mysql.

I’m using sql.from to query a column, and attempting to use findRecord or other scalar methods to identify and assign the string to a flux variable. I get the error [A] is not Record (argument tables) when trying to use the result, because, well, it’s not a flux record. I see that sql.from returns a stream of tables, but I’m not sure how to modify this stream of tables (actually just one table) so it can be accessed as a record.
How can I pull and assign this single string from the sql result set to a variable? Is there a method to convert the sql result to a flux record, or a method to work directly with the result set? Although it’s not working, here’s a sample of the current code I’m working with:

meta = sql.from(
  driverName: "mysql",
  query: "SELECT ids FROM meta_table WHERE id = 1"  )
  |> findRecord(fn: (key) => true, idx: 0 )

from(bucket: "data")
|> range(start: 2022-03-01T17:19:07Z, stop: 2022-03-01T23:19:07Z)
|> filter(fn: (r) => r["_measurement"] == "alt")
|> filter(fn: (r) => contains(value:, set: meta.ids ))


1 Like