src/astro/sql/operators/agnostic_save_file.py
def agnostic_write_file(self, df, output_file_path, output_conn_id=None):
        """Write dataframe to csv/parquet files formats

        Select output file format based on param output_file_format to class.
        """
        transport_params = {
            "s3": s3fs_creds,
            "gs": gcs_client,
            "": lambda: None,
        }[urlparse(output_file_path).scheme]()

        serialiser = {
            "parquet": df.to_parquet,
            "csv": df.to_csv,
            "json": df.to_json,
            "ndjson": df.to_json,
        }
        serialiser_params = {
            "csv": {"index": False},
            "json": {"orient": "records"},
            "ndjson": {"orient": "records", "lines": True},
        }
        with smart_open.open(
            output_file_path, mode="wb", transport_params=transport_params
        ) as stream:
            serialiser[self.output_file_format](
                stream, **serialiser_params.get(self.output_file_format, {})
            )
Write dataframe to csv/parquet files formats

        Select output file format based on param output_file_format to class.
        
Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class.
Write dataframe to csv / parquet files formats Select output file format based on param output_file_format to class .
def agnostic_write_file(self, df, output_file_path, output_conn_id=None):
        transport_params = {
            "s3": s3fs_creds,
            "gs": gcs_client,
            "": lambda: None,
        }[urlparse(output_file_path).scheme]()
        serialiser = {
            "parquet": df.to_parquet,
            "csv": df.to_csv,
            "json": df.to_json,
            "ndjson": df.to_json,
        }
        serialiser_params = {
            "csv": {"index": False},
            "json": {"orient": "records"},
            "ndjson": {"orient": "records", "lines": True},
        }
        with smart_open.open(
            output_file_path, mode="wb", transport_params=transport_params
        ) as stream:
            serialiser[self.output_file_format](
                stream, **serialiser_params.get(self.output_file_format, {})
            )
def agnostic_write_file ( self , df , output_file_path , output_conn_id = None ) : transport_params = { "s3" : s3fs_creds , "gs" : gcs_client , "" : lambda : None , } [ urlparse ( output_file_path ) . scheme ] ( ) serialiser = { "parquet" : df . to_parquet , "csv" : df . to_csv , "json" : df . to_json , "ndjson" : df . to_json , } serialiser_params = { "csv" : { "index" : False } , "json" : { "orient" : "records" } , "ndjson" : { "orient" : "records" , "lines" : True } , } with smart_open . open ( output_file_path , mode = "wb" , transport_params = transport_params ) as stream : serialiser [ self . output_file_format ] ( stream , ** serialiser_params . get ( self . output_file_format , { } ) )
Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class.
Write dataframe to csv / parquet files formats Select output file format based on param output_file_format to class .
"""Write dataframe to csv/parquet files formats

        Select output file format based on param output_file_format to class.
        """
self
df
output_file_path
output_conn_id