duckdb / duckdb-wasm

WebAssembly version of DuckDB
https://shell.duckdb.org
MIT License
1.02k stars 111 forks source link

Add simple shell script functionality to urlencode examples #341

Open ankoh opened 2 years ago

ankoh commented 2 years ago

Url-Encoding shell scripts would be very useful for issues and demos.

davidgasquez commented 2 years ago

Hey! Just curious if the following use case will be possible once this feature ships!

The idea is to publish a bunch of dbt compiled views queries somewhere. This is basically the result of export database 'database' (format parquet); for a database with only views for remote datasets.

Right now, these create statements could be copy-pasted but would be awesome if we could do something like load database github.com/user/repo/schema.sql and have the queries ready on any client (WASM, Python, ...)

Example of a compiled query ```sql /* {"app": "dbt", "dbt_version": "1.0.4", "profile_name": "default", "target_name": "dev", "node_id": "model.datadex.energy_data"} */ create view "main"."energy_data" as ( select iso_code, country, year, electricity_generation, biofuel_electricity, coal_electricity, fossil_electricity, gas_electricity, hydro_electricity, nuclear_electricity, oil_electricity, other_renewable_electricity, other_renewable_exc_biofuel_electricity, renewables_electricity, solar_electricity, wind_electricity, population, gdp from 'https://nyc3.digitaloceanspaces.com/owid-public/data/energy/owid-energy-data.csv' ); ; /* {"app": "dbt", "dbt_version": "1.0.4", "profile_name": "default", "target_name": "dev", "node_id": "model.datadex.energy_yearly_averages"} */ create view "main"."energy_yearly_averages" as ( select year, avg(electricity_generation) as avg_electricity_generation, avg(biofuel_electricity) as avg_biofuel_electricity, avg(coal_electricity) as avg_coal_electricity, avg(fossil_electricity) as avg_fossil_electricity, avg(gas_electricity) as avg_gas_electricity, avg(hydro_electricity) as avg_hydro_electricity, avg(nuclear_electricity) as avg_nuclear_electricity, avg(oil_electricity) as avg_oil_electricity, avg(renewables_electricity) as avg_renewables_electricity, avg(solar_electricity) as avg_solar_electricity, avg(wind_electricity) as avg_wind_electricity, avg(energy_per_gdp) as avg_energy_per_gdp, avg(energy_per_capita) as avg_energy_per_capita from 'https://nyc3.digitaloceanspaces.com/owid-public/data/energy/owid-energy-data.csv' group by 1 ); ; ```