Created
September 4, 2020 18:32
-
-
Save roaramburu/0608b5b3c9005cf952bd2318e51a66ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"BlazingContext ready\n" | |
] | |
} | |
], | |
"source": [ | |
"from blazingsql import BlazingContext\n", | |
"bc = BlazingContext()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(True,\n", | |
" '',\n", | |
" OrderedDict([('type', 's3'),\n", | |
" ('bucket_name', 'blazingsql-colab'),\n", | |
" ('access_key_id', ''),\n", | |
" ('secret_key', ''),\n", | |
" ('session_token', ''),\n", | |
" ('encryption_type', <S3EncryptionType.NONE: 1>),\n", | |
" ('kms_key_amazon_resource_name', ''),\n", | |
" ('endpoint_override', ''),\n", | |
" ('region', '')]))" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# register AWS S3 bucket\n", | |
"bc.s3('bsql_data', bucket_name='blazingsql-colab')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"bc.create_table('orders', 's3://bsql_data/tpch_sf10/orders/')\n", | |
"\n", | |
"bc.create_table('lineitem', 's3://bsql_data/tpch_sf10/lineitem/')\n", | |
"\n", | |
"bc.create_table('customer', 's3://bsql_data/tpch_sf10/customer/')\n", | |
"\n", | |
"bc.create_table('part', 's3://bsql_data/tpch_sf10/part/')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## List Tables" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['orders', 'lineitem', 'customer', 'part']" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"bc.list_tables()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Describe a Table" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'l_orderkey': 'int64',\n", | |
" 'l_partkey': 'int64',\n", | |
" 'l_suppkey': 'int64',\n", | |
" 'l_linenumber': 'int32',\n", | |
" 'l_quantity': 'float64',\n", | |
" 'l_extendedprice': 'float64',\n", | |
" 'l_discount': 'float64',\n", | |
" 'l_tax': 'float64',\n", | |
" 'l_returnflag': 'str',\n", | |
" 'l_linestatus': 'str',\n", | |
" 'l_shipdate': 'datetime64[ms]',\n", | |
" 'l_commitdate': 'datetime64[ms]',\n", | |
" 'l_receiptdate': 'datetime64[ms]',\n", | |
" 'l_shipinstruct': 'str',\n", | |
" 'l_shipmode': 'str',\n", | |
" 'l_comment': 'str'}" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"bc.describe_table('lineitem')" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "RAPIDS Nightly", | |
"language": "python", | |
"name": "rapids-nightly" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.9" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment