framework icon indicating copy to clipboard operation
framework copied to clipboard

SQL data loaders

Open mbostock opened this issue 2 years ago • 3 comments

It’d be nice to have foo.csv.sql and somehow automatically run against a registered database, and the CLI would convert the output to CSV automatically. I don’t know how we’d register the databases, though.

mbostock avatar Nov 13 '23 19:11 mbostock

YAML frontmatter or comments? Locality of configuration is nice for data loaders.

mythmon avatar Nov 13 '23 19:11 mythmon

We added client-side SQL code blocks using a sql front matter option. We could have .sql data loaders if we registered a database in the project config file.

mbostock avatar Mar 13 '24 05:03 mbostock

This would be fantastic. Right now I’m using dbt to version control the SQL data loaders for Observable Framework:

example - https://github.com/jaanli/exploring_american_community_survey_data/blob/main/american_community_survey/models/public_use_microdata_sample/figures/income-histogram-with-sector-historical-inflation-adjusted-industry-mapped.sql

corresponds to this observable framework plot: https://jaanli.github.io/american-community-survey/income

jaanli avatar Mar 13 '24 11:03 jaanli