Skip to content

Instantly share code, notes, and snippets.

@a1ea321
a1ea321 / sql_deps.py
Created August 21, 2024 05:42
Outputs a set of tables (or table-like stuff such as views) that are mentioned in a query. "dep" for "dependency".
import logging
from typing import Set, Iterator, Tuple, Optional
import mo_sql_parsing
def deps(query:str, db='', debug=False) -> Set[str]:
if query.strip() == '':
if debug:
return {}, set()
@a1ea321
a1ea321 / footmouse.py
Created July 16, 2018 12:05
footbased mouse
from sensor import Sensor
from pymouse import PyMouse
s = Sensor()
m = PyMouse()
# init sensor
while not s.get_single_sample(): pass