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

test: test for parquet output #86

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ aws --endpoint-url=http://localhost:4566 s3api put-object --bucket test-bucket -
# Make the bucket public.
aws --endpoint-url=http://localhost:4566 s3api put-bucket-acl --bucket test-bucket --acl public-read

# Create the parquet-bucket.
aws --endpoint-url=http://localhost:4566 s3 mb s3://parquet-bucket

# Make the bucket public.
aws --endpoint-url=http://localhost:4566 s3api put-bucket-acl --bucket parquet-bucket --acl public-read

pytest
15 changes: 15 additions & 0 deletions python/tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,18 @@ def test_read_from_s3():
arrow_table = session.sql(query).to_arrow()

assert len(arrow_table) == 2


def test_copy_to_s3():
"""Test copying to s3."""
session = connect()

s3_input_path = "s3://test-bucket/test.fasta"
parquet_output = "s3://parquet-bucket/test.parquet"

query = f"COPY (SELECT * FROM fasta_scan('{s3_input_path}')) TO '{parquet_output}' (FORMAT PARQUET)"

session.register_object_store_from_url(parquet_output)

# Should not raise an exception
session.execute(query)