Skip to content

Commit

Permalink
feat: full snowflake support (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
eakmanrq authored Jun 2, 2024
1 parent 7ef7a1b commit 6792fc1
Show file tree
Hide file tree
Showing 15 changed files with 1,574 additions and 248 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ stubs:
stubgen sqlframe/bigquery/functions.py --output ./ --inspect-mode
stubgen sqlframe/duckdb/functions.py --output ./ --inspect-mode
stubgen sqlframe/postgres/functions.py --output ./ --inspect-mode
stubgen sqlframe/snowflake/functions.py --output ./ --inspect-mode

package:
pip3 install wheel && python3 setup.py sdist bdist_wheel
Expand Down
1 change: 0 additions & 1 deletion docs/bigquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ print(session.catalog.listColumns(table_path))
* [soundex](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.soundex.html)
* [split](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.split.html)
* Regular expressions not supported
* [sqlglot_expression](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.sqlglot_expression.html)
* [sqrt](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.sqrt.html)
* [stddev](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.stddev.html)
* [stddev_pop](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.stddev_pop.html)
Expand Down
492 changes: 492 additions & 0 deletions docs/snowflake.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions sqlframe/base/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ def ensure_literal(cls, value) -> Column:
return lit(value)
return Column(value)

@property
def dtype(self) -> t.Optional[DataType]:
expression = self.expression.unalias()
if isinstance(expression, exp.Cast):
return expression.args.get("to")
return None

def copy(self) -> Column:
return Column(self.expression.copy())

Expand Down
Loading

0 comments on commit 6792fc1

Please sign in to comment.