19 lines
568 B
Python
19 lines
568 B
Python
from .config import config as cfg
|
|
import re
|
|
|
|
class SQLLoader():
|
|
|
|
def __init__(self, src_name, filepath) -> None:
|
|
super().__init__(src_name, filepath)
|
|
|
|
def _get_initial_load_query(self, query_name, query):
|
|
match = re.search(r'with ' + query_name + ' as \((.*?)\)', query, re.DOTALL)
|
|
if match:
|
|
initial_load_query = match.group(1).strip()
|
|
return initial_load_query
|
|
else:
|
|
return None
|
|
|
|
def init_load(self):
|
|
self._is_table_empty()
|
|
self._get_initial_load_query(query_name, query) |