-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 http proxy #13368
Add http proxy #13368
Conversation
Just realized there are 2 things missing from this:
|
Merge pull request duckdb/duckdb#13368 from samansmink/add-http-proxy
* chore: Update vendored sources to duckdb/duckdb@56619fa Merge pull request duckdb/duckdb#13368 from samansmink/add-http-proxy * ext fix --------- Co-authored-by: krlmlr <krlmlr@users.noreply.github.com> Co-authored-by: Kirill Müller <kirill@cynkra.com>
@samansmink can you clarify what the format of the
If I attempt to use the secrets method, I don't get this error immediately, but after a subsequent INSTALL call and then a long wait, I get the following instead (presumably after attempts to use the secret):
|
The parser exception sounds like a syntax error in your query. The correct syntax is as follows: set http_proxy='www-domain.com.au:8080'; |
You are quite right @Mytherin haha. I'll attempt to atone for my sins with a nice full example for others! Below is an example in python using the http proxy setting to read parquet files from an S3 bucket when behind a proxy: import duckdb
# get your proxy credentials
proxy_addr = 'www-proxy.domain.com'
proxy_user = 'yourusername'
proxy_pass = 'yourpassword'
# setup duckdb
con = duckdb.connect(':memory:')
con.execute(f"""
SET http_proxy='{proxy_addr}';
SET http_proxy_username='{proxy_user}';
SET http_proxy_password='{proxy_pass}';
INSTALL httpfs;
INSTALL aws;
LOAD httpfs;
LOAD aws;
CREATE SECRET ( TYPE S3, PROVIDER CREDENTIAL_CHAIN, CHAIN 'env' );
""") # may need to change CHAIN option to suit your own local handling of credentials (link below)
# run queries
sql = "SELECT * FROM read_parquet('s3://your-s3-bucket/*.parquet')"
df = con.execute(sql).df()
# see results
print(df) More info on options for the |
as per @samansmink comment earlier, is this available globally using create or replace secret for other extensions or is it unique only to httpfs ? duckdb works fine from a local mac, but when trying to use from duckdb cli from within local development docker in same MAC its giving ssl Error from duckdb cli, certs are added for the proxy under /etc/ssl/certs/ and all verify working from pip etc , only ENV variables are set also to cert locations but not adhering to trusted certs loaded, where does duckdb or how does it reference ssl certificates from duckdb cli ? using a different extenstion get below, is it duckdb or extension ?
|
great stuff - also see this is in the docs now https://duckdbsnippets.com/snippets/184/query-an-authenticated-api-endpoint |
Fixes #3836.
This PR's main goals is to expose http proxy and http_proxy credentials using basic auth in DuckDB. Along the way I added a few bits and bobs.
This PR includes:
http
secret type which hashttp
secret typeCREATE SECRET
statementExamples:
Add http proxy through settings:
Add http proxy through secret:
Add custom header map
Ping @dylanspag-lmco from #13361