CsvDataSource
File-based CSV data source. Each table is a separate CSV file.
Attributes
attributefile_path= Path(file_path)attributeunique_columns= unique_columnsattributetable_existsboolCheck if the CSV file exists and has content.
Functions
func__init__(self, file_path, unique_columns=None)paramselfparamfile_pathstr | Pathparamunique_columnslist[str] | None= NoneReturns
Nonefuncexists(self) → boolCheck if the CSV file exists.
paramselfReturns
boolTrue if the CSV file exists on disk
funcload_data(self) → pd.DataFrameLoad all data from the CSV file.
paramselfReturns
pandas.DataFrameContents of the CSV file, or empty DataFrame if file is missing
funcsave_data(self, data, overwrite=False)Save data to CSV. Accepts single dict, list of dicts, or DataFrame.
paramselfparamdataUnion[Dict[str, Any], List[Dict[str, Any]], pd.DataFrame]paramoverwritebool= FalseReturns
Nonefuncquery_data(self, conditions) → pd.DataFrameQuery data from CSV based on conditions.
paramselfparamconditionsDict[str, Any]Returns
pandas.pandas.DataFramefuncupdate_data(self, conditions, updates)Update existing data in CSV based on conditions.
paramselfparamconditionsDict[str, Any]paramupdatesTReturns
Nonefuncdelete_data(self, conditions)Delete data from CSV based on conditions.
paramselfparamconditionsDict[str, Any]Returns
Nonefuncgrab_column(self, column_name) → pd.SeriesRetrieve a specific column from CSV.
paramselfparamcolumn_namestrReturns
pandas.pandas.Seriesfuncgrab_row(self, index) → pd.SeriesRetrieve a specific row from CSV.
paramselfparamindexintReturns
pandas.pandas.Series