Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webmacro #198

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Add webmacro #198

merged 1 commit into from
Nov 18, 2024

Conversation

lmangani
Copy link
Contributor

DuckDB WebMacro

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

Installation

Coming Soon

Usage

Create a DuckDB SQL Macro statement and save it to a gist. Here's an example

Load your remote macro onto your system using the gist URL:

SELECT load_macro_from_url('https://gist.github.com/lmangani/518215a68e674ac662537d518799b893/raw/5f305480fdd7468f4ecda3686011bab8e8e711bf/bsky.sql') 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) │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘

@lmangani lmangani marked this pull request as ready for review November 18, 2024 08:12
@carlopi
Copy link
Collaborator

carlopi commented Nov 18, 2024

Thanks!

@carlopi carlopi merged commit fb6a522 into duckdb:main Nov 18, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants