Table Operations#

Function

Description

CREATE TABLE

Create a new table and its columns from a SQL query executed against an existing table.

DROP TABLES

Deletes the specified table, unregistering it.

EXPLAIN

Returns the Polars execution plan for a given SQL query.

SHOW TABLES

Returns a list of all tables registered in the given context.

UNNEST

Unnest one or more arrays as columns in a new table object.

TRUNCATE

Remove all data from a table without actually deleting it.

CREATE TABLE#

Create a new table and its columns from a SQL query executed against an existing table.

Example:

CREATE TABLE new_table AS
SELECT * FROM existing_table WHERE value > 42

DROP TABLES#

Deletes the specified table, unregistering it.

Example:

DROP TABLE old_table

EXPLAIN#

Returns the Polars execution plan for a given SQL query.

Example:

EXPLAIN SELECT * FROM some_table

SHOW TABLES#

Returns a list of all tables registered in the given context.

Example:

SHOW TABLES

UNNEST#

Unnest one or more arrays as columns in a new table object.

Example:

SELECT * FROM
  UNNEST(
    [1, 2, 3, 4],
    ['ww','xx','yy','zz'],
    [23.0, 24.5, 28.0, 27.5]
  ) AS tbl (x,y,z)

TRUNCATE#

Remove all data from a table without actually deleting it.

Example:

TRUNCATE TABLE some_table