Reputation: 742
I have quite complex query which I would like to use to create a table.
To create a regular table I can just run:
CREATE TABLE schemaName.tableName AS
WITH
my_query AS (SELECT ...)
SELECT col1, ... colN FROM my_query
Is there a way how to create this table partitioned by column col1
if col1
is a non-date string?
Upvotes: 1
Views: 6299
Reputation: 59375
Instead of partitioniong, consider clustering:
CREATE TABLE schemaName.tableName
PARTITION BY fake_date
CLUSTER BY col1
AS
WITH
my_query AS (SELECT ...)
SELECT col1, ... colN, DATE('2000-01-01') fake_date
FROM my_query
Benefits:
Upvotes: 2