renamed: FFAI/__pycache__/catch.cpython-313.pyc -> FFAICilent/__pycache__/catch.cpython-313.pyc renamed: FFAI/__pycache__/crawlers.cpython-313.pyc -> FFAICilent/__pycache__/crawlers.cpython-313.pyc renamed: FFAI/__pycache__/crawlers_core.cpython-313.pyc -> FFAICilent/__pycache__/crawlers_core.cpython-313.pyc renamed: FFAI/analyzer.py -> FFAICilent/analyzer.py renamed: FFAI/catch.py -> FFAICilent/catch.py new file: FFAICilent/cloud.py new file: FFAICilent/config/config.ini new file: FFAICilent/config/configloder.py renamed: FFAI/crawlers.py -> FFAICilent/crawlers.py renamed: FFAI/crawlers_core.py -> FFAICilent/crawlers_core.py new file: FFAICilent/local.py new file: FFAICilent/logger.py renamed: FFAI/main.py -> FFAICilent/main.py new file: FFAICilent/manger.py
17 lines
576 B
Python
17 lines
576 B
Python
import sqlite3
|
|
from logger import log
|
|
|
|
class LocalConnector:
|
|
def __init__(self, config):
|
|
self.db_path = config['Local']['db_path']
|
|
self.max_rows = int(config['Local']['max_rows'])
|
|
|
|
def execute(self, query):
|
|
try:
|
|
with sqlite3.connect(self.db_path) as conn:
|
|
cursor = conn.cursor()
|
|
cursor.execute(query)
|
|
return cursor.fetchmany(self.max_rows)
|
|
except Exception as e:
|
|
log.error(f"Local DB error: {str(e)}")
|
|
raise ConnectionError("Local storage unavailable") |