API Reference
FireSQL
- class firesql.sql.fire_sql.FireSQL
FireSQL is the main programming interface to execute FireSQL statements
During FireSQL initialization, the FireSQL parser is prepared from sql/grammar/firesql.lark.
- select_fields() List
From the parsed FireSQL select statement, return the select fields.
- Parameters:
None –
- Returns:
The list of select fields as strings
- execute(client: FireSQLAbstractClient, sql: str, options: Dict = {}) List
Given a Firebase connection, parse and execute all the FireSQL statements.
- Parameters:
client (FirebaseClient) – The client has established a Firebase connection
sql (str) – FireSQL statement to be executed
options (Dict) – Unused
- Returns:
A list of executed documents
- Return type:
docs
- execute_command(client: FireSQLAbstractClient, sqlCommand: Union[SQL_Select, SQL_Insert, SQL_Update, SQL_Delete], options: Dict = {}) List
Given a Firebase connection, execute a FireSQL statements.
- Parameters:
client (FirebaseClient) – The client has established a Firebase connection
sqlCommand (SQL_Select|SQL_Insert|SQL_Update|SQL_Delete) – FireSQL statement to be executed
options (Dict) – Unused
- Returns:
A list of executed documents
- Return type:
docs
- class firesql.sql.doc_printer.DocPrinter
The DocPrinter class is for printing the select documents as CSV or JSON format output.
Console output in the specified format.
- printCSV(docs, selectFields)
printCSV is to print the given list of documents from the select fields in CSV output format
- Parameters:
docs (List of documents as Dict) – the list of documents after FireSQL select query
selectFields (List of fields to output) – the list of select fields to be picked out from each document (as Dict)
- Returns:
string output in CSV format
- Return type:
str
- printJSON(docs, selectFields)
printJSON is to print the given list of documents from the select fields in JSON output format
- Parameters:
docs (List of documents as Dict) – the list of documents after FireSQL select query
selectFields (List of fields to output) – the list of select fields to be picked out from each document (as Dict)
- Returns:
string output in JSON format
- Return type:
str