Support querying files directly in posit connect with duckdb
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Tái hiện lỗi bằng cách sử dụng board.fs.info, duckdb.register_filesystem(board.fs) và read_parquet với đường dẫn rsc:// được hiển thị trong issue. So sánh ví dụ S3 đang hoạt động với đường dẫn Posit Connect và kiểm tra cách thông tin về tệp parquet được trả về; hoàn tất khi DuckDB có thể truy vấn trực tiếp parquet pin mà không gặp lỗi missing-magic-bytes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Since pins-python uses fsspec under the hood, users are able to query pins data directly using duckdb's fsspec integration.
While https://github.com/rstudio/pins-python/pull/193 allows duckdb to query CSV pins on posit connect, parquet files cannot be queried. This is likely because duckdb needs to scan parquet headers.
Below, I provide examples, but first--here is a snippet to enable logging to stdout:
import logging
import sys
root = logging.getLogger("pins")
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
handler.setFormatter(formatter)
root.addHandler(handler)
Querying parquet pins on s3 (for reference)
First, here is how you connect to a temporary s3 board, and return info on a file:
# create a temporary board, with the contents of the pins-compat test board ----
# note that my s3 credentials are in a .env file, see .env.dev
from dotenv import load_dotenv
load_dotenv()
bb = BoardBuilder("s3")
board = bb.create_tmp_board("pins/tests/pins-compat")
# display info for a csv file ----
board.fs.info(f"s3://{board.board}/df_csv/20220214T163718Z-eceac/df_csv.csv")
{'ETag': '"e6e2bc89538baa1ee31e3294efcb1d82"',
'LastModified': datetime.datetime(2023, 4, 12, 15, 22, 41, tzinfo=tzutc()),
'size': 20,
'name': 'ci-pins/222afb60-8e19-4cc0-b1a5-80098d0f410d/df_csv/20220214T163718Z-eceac/df_csv.csv',
'type': 'file',
'StorageClass': 'STANDARD',
'VersionId': None,
'ContentType': 'text/csv'}
Next, we'll add a parquet pin
from pins.data import mtcars
board.pin_write(mtcars, "df_parquet", type="parquet")
board.pin_versions("df_parquet")
created hash version
0 2023-04-12 11:30:57 69d97 20230412T113057Z-69d97
Finally, we'll query directly in duckdb
import duckdb
duckdb.register_filesystem(board.fs)
# query via duckdb! ----
data_path = f"s3://{board.board}/df_parquet/20230412T113057Z-69d97/df_parquet.parquet"
duckdb.execute(f"SELECT mpg FROM read_parquet('{data_path}')").df()
Querying parquet in pins
import pins
import duckdb
# note that my connect credentials are in a .env file
from dotenv import load_dotenv
load_dotenv()
# connect to board, register fs to duckdb ----
board = pins.board_connect("https://colorado.posit.co/rsc")
duckdb.register_filesystem(board.fs)
# look up bundle id ----
board.pin_meta("michael.chow/mtcars3")
# query with duckdb ----
duckdb.execute(
"SELECT * FROM read_parquet('rsc://michael.chow/mtcars3/72103/mtcars3.parquet')"
).df()
InvalidInputException: Invalid Input Error: No magic bytes found at end of file 'rsc://michael.chow/mtcars3/72103/mtcars3.parquet'
I think the issue has to do with how we're returning info on the file.
- Ngôn ngữ chính
- Python
- Star
- 59
- Fork
- 11
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rstudio/pins-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rstudio/pins-python#367 ·
-
.maint
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
rstudio/pins-python#280 ·
-
Test board github with a tokenĐang mởtesting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
rstudio/pins-python#196 ·
-
.enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
rstudio/pins-python#363 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
rstudio/pins-python#354 ·
Tất cả issue của rstudio/pins-python
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày