Database Tools
from furbain import databaseTools
createDatabase(databaseName)
Function to create a database. It will set the created database as the selected database.
Parameters :
databaseName
: Name of the database to create
Output :
Database "{databaseName}" created.
if successThe database "{databaseName}" already exists.
an exception raised
selectDatabase(databaseName, verbose=True)
Function to select database that will be used in the project
Parameters :
databaseName
: Name of the database to select (string)verbose
: print a confirmation messahe (boolean default:True
)
Output :
Database "{databaseName}" selected.
if successThe database "{databaseName}" does not exist.
an exception raised
executeSQLQueryOnDatabase(queryString)
Function to execute a SQL query on the selected database
Parameters :
queryString
: SQL query to execute (string)
Output :
- The results of the query
getAllDatabasesProjects()
Function to get the name of all the databases in the project
Output :
- A list of all the databases in the project
getTablesFromDatabase()
Function to get the name of all the tables in the selected database
Output :
- A list of all the tables in the selected database
deleteTable(tableName)
Function to delete a table from the selected database
Parameters :
tableName
: Name of the table to delete (string)
Output :
Table "{tableName}" deleted.
if successThe table "{tableName}" does not exist.
an exception raised
getDatabaseTableDataframe(tableName)
Function to get a dataframe of a table from the selected database Parameters :
tableName
: Name of the table to get (string)
Output :
- A dataframe of the table if success
The table "{tableName}" does not exist.
an exception raised