Initial version of report tools
Signed-off-by: Nikita <Nikita.Venkatesh@arm.com>
diff --git a/report-tools/adaptors/sql/sqlite.py b/report-tools/adaptors/sql/sqlite.py
new file mode 100755
index 0000000..0adf493
--- /dev/null
+++ b/report-tools/adaptors/sql/sqlite.py
@@ -0,0 +1,37 @@
+##############################################################################
+# Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+##############################################################################
+"""
+SQL adaptor for SQLite queries
+"""
+import sqlite3
+
+
+class Database:
+ """
+ Class used to represent an sqlite database
+
+ Methods:
+ execute_query: Executes and sqlite query and returns response
+ """
+
+ def __init__(self, db):
+ """Inits Database class with an sqlite db instance"""
+ self.mydb = sqlite3.connect(db)
+ self.cursor = self.mydb.cursor()
+
+ def execute_query(self, query):
+ """Executes a sqlite query
+ Args:
+ query(str): sqlite query
+ Returns:
+ response to the query
+ """
+ try:
+ self.cursor.execute(query)
+ self.mydb.commit()
+ return self.cursor.fetchall()
+ except sqlite3.Error as err:
+ raise err