News for hackers. Stuff that matters.
Re:FugueSQL: SQL-ish for pandas, dask, spark by crimsoneer on Monday October 11, 2021 @06:57PM (#28834058)
So, I'm a data science person who uses SQL largely to integrate with python or just for pretty straightforward extracts - my company is very data not mature. I've previously used MySql, postGresql, and have been considered DuckDB (though not clear I can store stuff outside of temp memory). Is this good? Is something else good?
Re:FugueSQL: SQL-ish for pandas, dask, spark by goodwanghan on Monday October 11, 2021 @08:22PM (#28834601)
Fugue SQL extends standard SQL so you can use SQL-ish language end to end.

For example, let's assume you use duckdb or mysql or other standard sql for data processing, how do you deal with intermediate tables?

You may have to frequently use CREATE TABLE and INSERT or write gigantic WITH statement to avoid the hassle. I guess many people use both.

In Fugue SQL, you can use simple assignment to do the same thing (Fugue may translate the assignment to CREATE TABLE or do something more efficient)

-------

a = CONNECT duckdb SELECT * FROM table1

b = LOAD "/tmp/src.parquet"

c = SELECT * FROM a LEFT SEMI JOIN b ON a.key = b.key

OUTPUT c USING mysql_dumper(table_name="temp", mode="append")

d = SELECT * FROM b UNION SELECT * FROM c

SAVE d OVERWRITE "/tmp/tmp.parquet"

--------

Look at the above Fugue SQL example, it's self-explaining, but how much extra code you have to write to achieve the same semantic without Fugue SQL?

Fugue SQL can provide a unified and minimal way to express your logic in SQL-ish way, while the real executions are done but those wonderful database solutions you mentioned.

Re:FugueSQL: SQL-ish for pandas, dask, spark by kvnkho on Monday October 11, 2021 @08:46PM (#28834717)
Hello, FugueSQL also supports SQL being the dominant language when describing computation. Current SQL interfaces are normally invoked between predominantly Python code. FugueSQL was created to support the other way around with SQL invoking Python code.

For example, with a python function

```python

# schema: , c:int

def add_new_col(df:pd.DataFrame) -> pd.DataFrame:

    df['c'] = 1

    return df

query = """SELECT FROM df TRANSFORM USING add_new_col"""

fsql(query).run()

# to run on Spark

fsql(query).run(SparkExecutionEngine)

```