-
Notifications
You must be signed in to change notification settings - Fork 2
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
DuckDB #205
Comments
I dropped an example in tpoisot/InterpretableSDMWithJulia#13 but maybe would be easier to paste in the thread. A few extra notes:
using DuckDB
# create a new in-memory database
con = DBInterface.connect(DuckDB.DB, ":memory:")
# create a table
DBInterface.execute(con, "INSTALL httpfs;")
DBInterface.execute(con, "LOAD httpfs;")
DBInterface.execute(con,
"CREATE OR REPLACE TEMPORARY VIEW gbif
AS SELECT * FROM
read_parquet('s3://gbif-open-data-us-east-1/occurrence/2023-10-01/occurrence.parquet/**')
;")
# Note that we can do aribtrary SQL operations, including
# geoparquet spatial queries, with minimal RAM footprint,
# over the full gbif
results = DBInterface.execute(con,
"SELECT *
FROM gbif
WHERE
(scientificname = 'Procyon lotor') AND
(decimallatitude BETWEEN -80.0 AND -58.501) AND
(decimallongitude BETWEEN 41.0 AND 51.999)") |
I definitely need to read more about this, but if it is a viable alternative to the streaming API, I'm all for it. Do you know if there's a similar endpoint for the taxonomy? |
Looks like that's the only one they post to AWS open data, but we could ask the GBIF team about that. The current taxonomic backbone (and other snapshots) can be downloaded as a For now I just dropped that copy on my MINIO server so I think this should work: DBInterface.execute(con,
"CREATE OR REPLACE TEMPORARY VIEW taxon
AS SELECT * FROM
read_csv('https://minio.carlboettiger.info/gbif/Taxon.tsv',
delim='\\t', header=true, quote='', auto_detect=true);")
taxon = DBInterface.execute(con, "SELECT * FROM Taxon") |
Tagging @cboettig - would you be open to sharing the code snippet you showed me after the workshop?
The text was updated successfully, but these errors were encountered: