Skip to content

Conversation

@carlopi
Copy link
Contributor

@carlopi carlopi commented Dec 13, 2024

Idea is for wasm_httplib_replacement.hpp (or a less hacky version of it) to be part of duckdb/duckdb for 1.2, and expose a subset of HttpLib interface.

This will not, as of now, work in DuckDB-Wasm + node, I have the code also there but this is good enough to get started.

This is a simpler problem than evidence-dev/duckdb_gsheets#35, where a slightly more complex API needs to be mocked.

I have tested this in limited ways locally, and error detection / handling should likely improve (HandleHttpError just do nothing).

Demo:
image

@lmangani
Copy link
Contributor

lmangani commented Dec 13, 2024

@carlopi

@lmangani lmangani merged commit 2430526 into Query-farm:main Dec 13, 2024
22 checks passed
@carlopi
Copy link
Contributor Author

carlopi commented Dec 13, 2024

Note that CORS is not correctly set up on gist.github.com, BUT there is a mirror with CORS enabled.

Once this is merged and in community extensions,

INSTALL webmacro FROM community;
LOAD webmacro;
SELECT load_macro_from_url('https://gist.githubusercontent.com/lmangani/518215a68e674ac662537d518799b893/raw/5f305480fdd7468f4ecda3686011bab8e8e711bf/bsky.sql') as res;
SELECT * FROM search_posts('qxip.bsky.social', text := 'quack');

Should work (but not the query on the readme)

But

SELECT load_macro_from_url('https://gist.github.com/lmangani/518215a68e674ac662537d518799b893/raw/5f305480fdd7468f4ecda3686011bab8e8e711bf/bsky.sql') as res;

will crash badly (since failures are not handled), let me fix it.

@carlopi carlopi deleted the wasm_httplib_replacement branch December 13, 2024 14:39
@carlopi
Copy link
Contributor Author

carlopi commented Dec 13, 2024

Too late, anyhow, can also go in a separate PR, basically something need to be thrown in HandleHttpError, I will send a PR in a bit.

@lmangani
Copy link
Contributor

Sorry I saw the tests complete and merged! Ready for the next PR and halted the community update until then

@lmangani
Copy link
Contributor

I updated the readme example as suggested with githubusercontent

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