Sql vs mysql pytho8/31/2023 ![]() Of course, we can do the same thing as in the example above: df = bc.sql('SELECT * FROM my_table') ![]() Having created a table (or tables), we can now start using the engine to do something interesting. ![]() Then, create the table as follows: bc.create_table('my_remote_table', 's3://bucket/path_to_my_file.csv', header=1) However, if we want to access the data stored in an Amazon S3 bucket, we need to first register the S3 endpoint with the BlazingContext: bc.s3( If the data we want to use is on our disk (or on the local network), the call is almost the same but instead of the DataFrame pass the path to the file (or files if the dataset is partitioned) bc.create_table('my_table', 'path_to_my_file.parquet') To create a table from cuDF simply pass the DataFrame along with the name of the table: bc.create_table('my_table', my_cudf_df) The table can be either a cuDF DataFrame, Dask cuDF DataFrame, or a local or remote file. Now we can create a table so we can query it. The easiest way to do so is to start with default parameters (see the cheat sheet for a more detailed example of starting BlazingContext): from blazingsql import BlazingContext However, before we can start querying our data we need to create a BlazingContext that is an entry point for all things BlazingSQL. The query selects all the columns and all the rows from the table. Doing so is, thus, trivial: SELECT * FROM table Querying dataĪs the name suggests, SQL was built with the purpose of querying data. BlazingSQL builds on RAPIDS and can query cuDF DataFrames (or dask_cudf DataFrames) stored in the GPU memory, or Parquet, CSV/TSV, JSON, and ORC files (and any format that RAPIDS will eventually support) stored both locally and remotely. BlazingSQL uses Apache Calcite to parse the query that produces the relational algebra which then gets executed as CUDA kernels on a GPU. However, the adherence to the ANSI SQL standard is not enforced and varies between different implementations thus making the SQL language hard to port between databases.īlazingSQL is not a database but rather a SQL engine that understands the SQL language and can apply it to process data using GPUs. Fundamentally, it supports all the atomic data types like fixed-length NUMERIC or DECIMAL, integer and floating types, booleans, time (date, timestamp, time and interval), strings, and blobs but many vendor derivatives introduced additional data types like images or audio (via blobs), or spatial to name a few. It was first standardized in 1986 and has since been updated nine times, last in 1999. The language is based on relational algebra that defines tables in terms of algebraic structures and relations, and explains how to run queries on them. The original naming was not accidental: just like many popular programming languages, SQL makes its code easily readable and understandable by an English speaking programmer. The name was later shorted to become SQL (pronounced literally as S-Q-L) but many still pronounce it /ˈsiːkwəl/ (or see-quell) after the original name. ![]() The structured querying language originated at IBM and was initially called SEQUEL: Structured English QUEry Language. To help with getting familiar with BlazingSQL, we also published a BlazingSQL cheatsheet, and an interactive notebook with all the current functionality of BlazingSQL. In this post, we introduce Blazing SQL, a SQL engine that runs on NVIDIA GPUs. And while SQL language adopted by each solution might vary with its own extensions and features, fundamentally they derive from ANSI SQL. SQL Server, Teradata SQL, or Oracle databases have been known in the enterprise setting while Open Source Software (OSS) solutions like MySQL (or its fork MariaBD) and Postgres have garnered a large following and widespread adoption over the years among enthusiasts and companies. ![]() The most common and standardized, the ANSI SQL, is a de facto standard that other tools derive from with some changes. Multiple flavors of SQL language exist but at the core, they are quite similar. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |