5.4. Table loader classes¶
5.4.1. TableData¶
5.4.2. TableLoader class¶
5.4.3. CsvTableLoader class¶
-
class
simplesqlite.loader.csv.core.CsvTableLoader(source)[source]¶ Bases:
simplesqlite.loader.interface.TableLoaderAbstract class of CSV table loader.
-
header_list¶ Attribute names of the table. Use the first line of the csv file as attribute list if header_list is empty.
-
delimiter¶ A one-character string used to separate fields. Defaults to
",".
-
quotechar¶ A one-character string used to quote fields containing special characters, such as the
delimiterorquotechar, or which contain new-line characters. Defaults to'"'.
-
encoding¶ Encoding of the CSV data.
-
load()¶
-
make_table_name()¶
-
5.4.4. CsvTableFileLoader class¶
-
class
simplesqlite.loader.CsvTableFileLoader(file_path=None)[source]¶ Bases:
simplesqlite.loader.csv.core.CsvTableLoaderConcrete class of CSV file loader.
-
table_name¶ Table name string. Defaults to
%(filename)s.
-
load()[source]¶ Load table data from a CSV file.
Returns: Loaded table data. Table name is determined by make_table_name().Return type: iterator of TableDataRaises: InvalidDataError – If the CSV data is invalid. See also
-
5.4.5. CsvTableTextLoader class¶
-
class
simplesqlite.loader.CsvTableTextLoader(text)[source]¶ Bases:
simplesqlite.loader.csv.core.CsvTableLoaderConcrete class of CSV text loader.
-
load()[source]¶ Load table data from a CSV text.
Returns: Loaded table data. Return type: iterator of TableDataRaises: InvalidDataError – If the CSV data is invalid. See also
-
make_table_name()¶
-
5.4.6. JsonTableFileLoader class¶
-
class
simplesqlite.loader.JsonTableFileLoader(file_path=None)[source]¶ Bases:
simplesqlite.loader.interface.TableLoaderConcrete class of JSON file loader.
-
load()[source]¶ Load a JSON file from
sourcethat includes table data. First, single table data in a file, acceptable JSON schema is as follows:{ "type": "array", "items": { "type": "object", "additionalProperties": { "anyOf": [ {"type": "string"}, {"type": "number"}, {"type": "null"}, ], }, }, }
Second, multiple table data in a file, acceptable JSON schema is as follows:
{ "type": "object", "additionalProperties": { "type": "array", "items": { "type": "object", "additionalProperties": { "anyOf": [ {"type": "string"}, {"type": "number"}, {"type": "null"} ] } } } }
The table name string is making from
table_name. Following format specifiers are replaced with specific string.format specifier value after the replacement %(filename)sFilename. Defaults to single JSON table. %(key)sKey of the table data (only for multiple JSON table). Defaults to multiple JSON table. Returns: Loaded table data. Return type: iterator of TableData
-
5.4.7. JsonTableTextLoader class¶
5.4.8. SpreadSheetLoader class¶
-
class
simplesqlite.loader.spreadsheet.core.SpreadSheetLoader(source)[source]¶ Bases:
simplesqlite.loader.interface.TableLoaderAbstract class of table data. Especially spreadsheets that consists multiple rows.
-
table_name¶ Table name string. Defaults to
%(sheet)s.
-
start_row¶ The first row to search header row.
-
5.4.9. ExcelTableFileLoader class¶
-
class
simplesqlite.loader.ExcelTableFileLoader(file_path=None)[source]¶ Bases:
simplesqlite.loader.spreadsheet.core.SpreadSheetLoaderConcrete class of Microsoft Excel TM file loader.
-
load()[source]¶ Load table data from an Excel file. This method will automatically search the header row start from
start_row. Conditions of the header row is that all of the columns has value (except empty columns).Returns: Loaded table data. Return one TableData for each sheet in the workbook. Table name is determined by make_table_name().Return type: iterator of TableDataRaises: InvalidDataError – If the header row is not found.
-
5.4.10. GoogleSheetsTableLoader class¶
-
class
simplesqlite.loader.GoogleSheetsTableLoader(file_path=None)[source]¶ Bases:
simplesqlite.loader.spreadsheet.core.SpreadSheetLoaderConcrete class of Google Spreadsheet loader.
Requirements:
-
load()[source]¶ Load table data from a Google Spreadsheet. This method will automatically search the header row start from
start_row. Conditions of the header row is that all of the columns has value (except empty columns).Returns: Loaded table data. Return one TableData for each sheet in the workbook. Table name is determined by make_table_name().Return type: iterator of TableDataRaises: InvalidDataError – If the header row is not found.
-