Skip to content

quackscience/duckdb-extension-webmacro

Repository files navigation

DuckDB WebMacro Extension

This extension allows loading DuckDB Macros (both scalar and table) from URLs, gists, pasties, etc.

Installation

INSTALL webmacro FROM community;
LOAD webmacro;

Usage

Create a DuckDB SQL Macro and save it somewhere. Here's an example

Load your remote macro onto your system using a URL:

SELECT load_macro_from_url('https://quacks.cc/r/search_posts') as res;
┌─────────────────────────────────────────┐
│                   res                   │
│                 varchar                 │
├─────────────────────────────────────────┤
│ Successfully loaded macro: search_posts │
└─────────────────────────────────────────┘

Use your new macro and have fun:

D SELECT * FROM search_posts('qxip.bsky.social', text := 'quack');
┌──────────────────┬──────────────┬──────────────────────┬───┬─────────┬─────────┬───────┬────────┐
│  author_handle   │ display_name │      post_text       │ … │ replies │ reposts │ likes │ quotes │
│     varcharvarcharvarchar        │   │  int64  │  int64  │ int64 │ int64  │
├──────────────────┼──────────────┼──────────────────────┼───┼─────────┼─────────┼───────┼────────┤
│ qxip.bsky.social │ qxip         │ This is super cool…  │ … │       1010 │
│ qxip.bsky.social │ qxip         │ github.com/quacksc…  │ … │       0120 │
│ qxip.bsky.social │ qxip         │ #DuckDB works grea…  │ … │       2 │       3 │    24 │      0 │qxip.bsky.social │ qxip         │ github.com/quacksc…  │ … │       1000 │
│ qxip.bsky.social │ qxip         │ The latest #Quackp…  │ … │       0 │       0 │     2 │      0 │qxip.bsky.social │ qxip         │ The #DuckDB Ecosys…  │ … │       0 │       0 │     5 │      0 │qxip.bsky.social │ qxip         │ Ladies and Gents, …  │ … │       1040 │
├──────────────────┴──────────────┴──────────────────────┴───┴─────────┴─────────┴───────┴────────┤
│ 7 rows                                                                      9 columns (7 shown) │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘

Example

webmacro_example

About

DuckDB WebMacro: Share and Load your SQL Macros via gists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published