@@ -18,6 +18,8 @@ Classes
1818
1919 datafusion.dataframe.Compression
2020 datafusion.dataframe.DataFrame
21+ datafusion.dataframe.DataFrameWriteOptions
22+ datafusion.dataframe.InsertOp
2123 datafusion.dataframe.ParquetColumnOptions
2224 datafusion.dataframe.ParquetWriterOptions
2325
@@ -240,10 +242,20 @@ Module Contents
240242
241243 Drop arbitrary amount of columns.
242244
243- :param columns: Column names to drop from the dataframe.
245+ Column names are case-sensitive and do not require double quotes like
246+ other operations such as `select `. Leading and trailing double quotes
247+ are allowed and will be automatically stripped if present.
248+
249+ :param columns: Column names to drop from the dataframe. Both ``column_name ``
250+ and ``"column_name" `` are accepted.
244251
245252 :returns: DataFrame with those columns removed in the projection.
246253
254+ Example Usage::
255+
256+ df.drop('ID_For_Students') # Works
257+ df.drop('"ID_For_Students"') # Also works (quotes stripped)
258+
247259
248260
249261 .. py :method :: except_all(other: DataFrame) -> DataFrame
@@ -361,9 +373,19 @@ Module Contents
361373
362374
363375
364- .. py :method :: into_view() -> pyarrow .Table
376+ .. py :method :: into_view() -> datafusion.catalog .Table
365377
366- Convert DataFrame as a ViewTable which can be used in register_table.
378+ Convert ``DataFrame `` into a :class: `~datafusion.Table `.
379+
380+ .. rubric :: Examples
381+
382+ >>> from datafusion import SessionContext
383+ >>> ctx = SessionContext()
384+ >>> df = ctx.sql(" SELECT 1 AS value" )
385+ >>> view = df.into_view()
386+ >>> ctx.register_table(" values_view" , view)
387+ >>> df.collect() # The DataFrame is still usable
388+ >>> ctx.sql(" SELECT value FROM values_view" ).collect()
367389
368390
369391
@@ -436,6 +458,27 @@ Module Contents
436458
437459
438460
461+ .. py :method :: parse_sql_expr(expr: str ) -> datafusion.expr.Expr
462+
463+ Creates logical expression from a SQL query text.
464+
465+ The expression is created and processed against the current schema.
466+
467+ Example::
468+
469+ from datafusion import col, lit
470+ df.parse_sql_expr("a > 1")
471+
472+ should produce:
473+
474+ col("a") > lit(1)
475+
476+ :param expr: Expression string to be converted to datafusion expression
477+
478+ :returns: Logical expression .
479+
480+
481+
439482 .. py :method :: repartition(num: int ) -> DataFrame
440483
441484 Repartition a DataFrame into ``num `` partitions.
@@ -693,60 +736,119 @@ Module Contents
693736
694737
695738
696- .. py :method :: write_csv(path: str | pathlib.Path, with_header: bool = False ) -> None
739+ .. py :method :: write_csv(path: str | pathlib.Path, with_header: bool = False , write_options: DataFrameWriteOptions | None = None ) -> None
697740
698741 Execute the :py:class: `DataFrame ` and write the results to a CSV file.
699742
700743 :param path: Path of the CSV file to write.
701744 :param with_header: If true, output the CSV header row.
745+ :param write_options: Options that impact how the DataFrame is written.
702746
703747
704748
705- .. py :method :: write_json(path: str | pathlib.Path) -> None
749+ .. py :method :: write_json(path: str | pathlib.Path, write_options: DataFrameWriteOptions | None = None ) -> None
706750
707751 Execute the :py:class: `DataFrame ` and write the results to a JSON file.
708752
709753 :param path: Path of the JSON file to write.
754+ :param write_options: Options that impact how the DataFrame is written.
710755
711756
712757
713- .. py :method :: write_parquet(path: str | pathlib.Path, compression: str , compression_level: int | None = None ) -> None
714- write_parquet(path: str | pathlib.Path, compression: Compression = Compression.ZSTD , compression_level: int | None = None ) -> None
715- write_parquet(path: str | pathlib.Path, compression: ParquetWriterOptions, compression_level: None = None ) -> None
758+ .. py :method :: write_parquet(path: str | pathlib.Path, compression: str , compression_level: int | None = None , write_options: DataFrameWriteOptions | None = None ) -> None
759+ write_parquet(path: str | pathlib.Path, compression: Compression = Compression.ZSTD , compression_level: int | None = None , write_options: DataFrameWriteOptions | None = None ) -> None
760+ write_parquet(path: str | pathlib.Path, compression: ParquetWriterOptions, compression_level: None = None , write_options: DataFrameWriteOptions | None = None ) -> None
716761
717762 Execute the :py:class: `DataFrame ` and write the results to a Parquet file.
718763
764+ Available compression types are:
765+
766+ - "uncompressed": No compression.
767+ - "snappy": Snappy compression.
768+ - "gzip": Gzip compression.
769+ - "brotli": Brotli compression.
770+ - "lz4": LZ4 compression.
771+ - "lz4_raw": LZ4_RAW compression.
772+ - "zstd": Zstandard compression.
773+
774+ LZO compression is not yet implemented in arrow-rs and is therefore
775+ excluded.
776+
719777 :param path: Path of the Parquet file to write.
720778 :param compression: Compression type to use. Default is "ZSTD".
721- Available compression types are:
722- - "uncompressed": No compression.
723- - "snappy": Snappy compression.
724- - "gzip": Gzip compression.
725- - "brotli": Brotli compression.
726- - "lz4": LZ4 compression.
727- - "lz4_raw": LZ4_RAW compression.
728- - "zstd": Zstandard compression.
729- :param Note: LZO is not yet implemented in arrow-rs and is therefore excluded.
730779 :param compression_level: Compression level to use. For ZSTD, the
731780 recommended range is 1 to 22, with the default being 4. Higher levels
732781 provide better compression but slower speed.
782+ :param write_options: Options that impact how the DataFrame is written.
733783
734784
735785
736- .. py :method :: write_parquet_with_options(path: str | pathlib.Path, options: ParquetWriterOptions) -> None
786+ .. py :method :: write_parquet_with_options(path: str | pathlib.Path, options: ParquetWriterOptions, write_options: DataFrameWriteOptions | None = None ) -> None
737787
738788 Execute the :py:class: `DataFrame ` and write the results to a Parquet file.
739789
740790 Allows advanced writer options to be set with `ParquetWriterOptions `.
741791
742792 :param path: Path of the Parquet file to write.
743793 :param options: Sets the writer parquet options (see `ParquetWriterOptions `).
794+ :param write_options: Options that impact how the DataFrame is written.
795+
796+
797+
798+ .. py :method :: write_table(table_name: str , write_options: DataFrameWriteOptions | None = None ) -> None
799+
800+ Execute the :py:class: `DataFrame ` and write the results to a table.
801+
802+ The table must be registered with the session to perform this operation.
803+ Not all table providers support writing operations. See the individual
804+ implementations for details.
744805
745806
746807
747808 .. py :attribute :: df
748809
749810
811+ .. py :class :: DataFrameWriteOptions(insert_operation: InsertOp | None = None , single_file_output: bool = False , partition_by: str | collections.abc.Sequence[str ] | None = None , sort_by: datafusion.expr.Expr | datafusion.expr.SortExpr | collections.abc.Sequence[datafusion.expr.Expr] | collections.abc.Sequence[datafusion.expr.SortExpr] | None = None )
812+
813+ Writer options for DataFrame.
814+
815+ There is no guarantee the table provider supports all writer options.
816+ See the individual implementation and documentation for details.
817+
818+ Instantiate writer options for DataFrame.
819+
820+
821+ .. py :attribute :: _raw_write_options
822+
823+
824+ .. py :class :: InsertOp(* args, ** kwds)
825+
826+ Bases: :py:obj: `enum.Enum `
827+
828+
829+ Insert operation mode.
830+
831+ These modes are used by the table writing feature to define how record
832+ batches should be written to a table.
833+
834+
835+ .. py :attribute :: APPEND
836+
837+ Appends new rows to the existing table without modifying any existing rows.
838+
839+
840+ .. py :attribute :: OVERWRITE
841+
842+ Overwrites all existing rows in the table with the new rows.
843+
844+
845+ .. py :attribute :: REPLACE
846+
847+ Replace existing rows that collide with the inserted rows.
848+
849+ Replacement is typically based on a unique key or primary key.
850+
851+
750852.. py :class :: ParquetColumnOptions(encoding: Optional[str ] = None , dictionary_enabled: Optional[bool ] = None , compression: Optional[str ] = None , statistics_enabled: Optional[str ] = None , bloom_filter_enabled: Optional[bool ] = None , bloom_filter_fpp: Optional[float ] = None , bloom_filter_ndv: Optional[int ] = None )
751853
752854 Parquet options for individual columns.
0 commit comments