https://github.com/quackscience/duckdb-extension-webmacro
DuckDB WebMacro: Share and Load your SQL Macros via gists
https://github.com/quackscience/duckdb-extension-webmacro
Last synced: 11 months ago
JSON representation
DuckDB WebMacro: Share and Load your SQL Macros via gists
- Host: GitHub
- URL: https://github.com/quackscience/duckdb-extension-webmacro
- Owner: quackscience
- License: mit
- Created: 2024-11-17T13:15:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-15T14:28:33.000Z (over 1 year ago)
- Last Synced: 2025-05-08T05:52:35.482Z (11 months ago)
- Language: C++
- Homepage: https://duckdb.org/community_extensions/extensions/webmacro.html
- Size: 55.7 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# DuckDB WebMacro Extension
This extension allows loading DuckDB Macros (both scalar and table) from URLs, gists, pasties, etc.
### Installation
```sql
INSTALL webmacro FROM community;
LOAD webmacro;
```
### Usage
Create a DuckDB SQL Macro and save it somewhere. Here's an [example](https://gist.githubusercontent.com/lmangani/518215a68e674ac662537d518799b893)
Load your remote macro onto your system using a URL:
```sql
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:
```sql
D SELECT * FROM search_posts('qxip.bsky.social', text := 'quack');
┌──────────────────┬──────────────┬──────────────────────┬───┬─────────┬─────────┬───────┬────────┐
│ author_handle │ display_name │ post_text │ … │ replies │ reposts │ likes │ quotes │
│ varchar │ varchar │ varchar │ │ int64 │ int64 │ int64 │ int64 │
├──────────────────┼──────────────┼──────────────────────┼───┼─────────┼─────────┼───────┼────────┤
│ qxip.bsky.social │ qxip │ This is super cool… │ … │ 1 │ 0 │ 1 │ 0 │
│ qxip.bsky.social │ qxip │ github.com/quacksc… │ … │ 0 │ 1 │ 2 │ 0 │
│ qxip.bsky.social │ qxip │ #DuckDB works grea… │ … │ 2 │ 3 │ 24 │ 0 │
│ qxip.bsky.social │ qxip │ github.com/quacksc… │ … │ 1 │ 0 │ 0 │ 0 │
│ 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, … │ … │ 1 │ 0 │ 4 │ 0 │
├──────────────────┴──────────────┴──────────────────────┴───┴─────────┴─────────┴───────┴────────┤
│ 7 rows 9 columns (7 shown) │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
```
### Example
