eakmanrq / sqlframe

Turning PySpark Into a Universal DataFrame API
https://sqlframe.readthedocs.io/en/stable/
MIT License
191 stars 3 forks source link

Support for PySpark `printSchema` Method #25

Closed earlev4 closed 2 months ago

earlev4 commented 2 months ago

Hello @eakmanrq! Thank you very much for the SQLFrame project! I really appreciate the efforts you put into it.

Just curious, will pyspark.sql.DataFrame.printSchema be supported?

Example usage:

from sqlframe.duckdb import DuckDBSession
from sqlframe.duckdb import functions as F
from sqlframe.duckdb import DuckDBDataFrame

session = DuckDBSession()

df_employee = session.createDataFrame(
    [
        {"id": 1, "fname": "Jack", "lname": "Shephard", "age": 37, "store_id": 1},
        {"id": 2, "fname": "John", "lname": "Locke", "age": 65, "store_id": 2},
        {"id": 3, "fname": "Kate", "lname": "Austen", "age": 37, "store_id": 3},
        {"id": 4, "fname": "Claire", "lname": "Littleton", "age": 27, "store_id": 1},
        {"id": 5, "fname": "Hugo", "lname": "Reyes", "age": 29, "store_id": 3},
    ]
)

df_employee.printSchema()

Thanks again!!!

eakmanrq commented 2 months ago

Yes that should be possible. Will likely look into adding this in a few days. Thanks for pointing it out!

earlev4 commented 2 months ago

Thanks so much, @eakmanrq!!! That's wonderful news. I appreciate it!

eakmanrq commented 2 months ago

@earlev4 support added for DuckDB and Postgres in 1.2.0: https://github.com/eakmanrq/sqlframe/releases/tag/v1.2.0

earlev4 commented 2 months ago

Thank you very, very much @eakmanrq! I very much appreciate it!!!