moj-analytical-services / pydbtools

Python version of dbtools
https://moj-analytical-services.github.io/pydbtools/
10 stars 2 forks source link

CREATE TEMP TABLE #16

Closed isichei closed 3 years ago

isichei commented 4 years ago

We should add this functionality:

import pydbtools as pydb

pydb.create_temp_table(sql, table_name)

The above function would wrap their sql into:

f"""
CREATE TABLE user_name.{table_name} AS
WITH properties (
s3_location, <Same location as where we dump user tables>
format='parquet'
)
{sql}
"""

Thoughts on the above: