db module for Auth

This commit is contained in:
2024-11-14 15:16:39 +03:00
parent 28ec057726
commit 751fb0c20d
5 changed files with 2 additions and 2 deletions

View File

@@ -1,14 +0,0 @@
import os
from string import Template
class SQLProvider:
def __init__(self, file_path):
self.scripts = {}
for file in os.listdir(file_path):
_sql = open(f'{file_path}/{file}').read()
self.scripts[file] = Template(_sql)
def get(self, name, params) -> dict:
if name not in self.scripts:
raise ValueError(f'SQL template {name} not found')
return self.scripts[name].substitute(**params)