enabled syntax highlighting for queries
This commit is contained in:
@@ -8,29 +8,29 @@ class GroupQueries(BaseQueries):
|
||||
self.table = GROUP_TABLE
|
||||
|
||||
def select_one_by_id(self) -> dict:
|
||||
query = f"SELECT * FROM {self.table}"
|
||||
db = self.connect_db()
|
||||
cursor = db.cursor(dictionary=True)
|
||||
query = f"""-- sql
|
||||
SELECT * FROM {self.table}
|
||||
"""
|
||||
cursor, conn = self.get_cursor_and_conn()
|
||||
cursor.execute(query)
|
||||
data = cursor.fetchone()
|
||||
cursor.close()
|
||||
db.close()
|
||||
data: dict = cursor.fetchone() # type: ignore
|
||||
self.close_cursor_and_conn(cursor, conn)
|
||||
|
||||
if not data:
|
||||
raise Exception("error retrieving group")
|
||||
|
||||
return data
|
||||
|
||||
def select_all_series(self) -> None:
|
||||
def select_all(self) -> None:
|
||||
raise NotImplementedError(
|
||||
"get_all method not implemented for GroupQueries. There's only one row in the table."
|
||||
)
|
||||
|
||||
def update_group_bio(self, bio: str) -> None:
|
||||
db = self.connect_db()
|
||||
cursor = db.cursor()
|
||||
query = f"UPDATE {self.table} SET bio = %s WHERE id = 1" # only one row in the table
|
||||
cursor, conn = self.get_cursor_and_conn()
|
||||
query = f"""-- sql
|
||||
UPDATE {self.table} SET bio = %s WHERE id = 1
|
||||
""" # only one row in the table
|
||||
cursor.execute(query, (bio,))
|
||||
db.commit()
|
||||
cursor.close()
|
||||
db.close()
|
||||
conn.commit()
|
||||
self.close_cursor_and_conn(cursor, conn)
|
||||
|
||||
Reference in New Issue
Block a user