I'd like to use Ibis to create a table from literal values instead of a table.
In BigQuery SQL, I might do this with the a combination of the array and struct data types. See this example from the BigQuery docs.
WITH races AS (
SELECT "800M" AS race,
[STRUCT("Rudisha" as name, [23.4, 26.3, 26.4, 26.1] as laps),
STRUCT("Makhloufi" as name, [24.5, 25.4, 26.6, 26.1] as laps),
STRUCT("Murphy" as name, [23.9, 26.0, 27.0, 26.0] as laps),
STRUCT("Bosse" as name, [23.6, 26.2, 26.5, 27.1] as laps),
STRUCT("Rotich" as name, [24.7, 25.6, 26.9, 26.4] as laps),
STRUCT("Lewandowski" as name, [25.0, 25.7, 26.3, 27.2] as laps),
STRUCT("Kipketer" as name, [23.2, 26.1, 27.3, 29.4] as laps),
STRUCT("Berian" as name, [23.7, 26.1, 27.0, 29.3] as laps)]
AS participants)
SELECT
race,
participant
FROM races r
CROSS JOIN UNNEST(r.participants) as participant;
The ibis.table()
method only constructs an empty table with a given schema, so I'm not sure how one might go from such a table to one with literal values. Also, the fact that the table is unbound makes it difficult to use in many backends.
This is now available via ibis.memtable
-- there's a brief explainer available here: https://ibis-project.org/how_to/memtable-join/