@RyanMarcus/

moz_sql_parse recursion

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sql = """
SELECT * FROM aka_name AS an, cast_info AS ci, info_type AS it, link_type AS lt, movie_link AS ml, name AS n, person_info AS pi, title AS t WHERE
an.name  is not NULL
and (an.name LIKE '%a%' or an.name LIKE 'A%')
AND it.info ='mini biography'
AND lt.link  in ('references', 'referenced in', 'features', 'featured in')
AND n.name_pcode_cf BETWEEN 'A' AND 'F'
AND (n.gender = 'm' OR (n.gender = 'f' AND n.name LIKE 'A%'))
AND pi.note  is not NULL
AND t.production_year BETWEEN 1980 AND 2010
AND n.id = an.person_id AND n.id = pi.person_id AND ci.person_id = n.id AND t.id = ci.movie_id AND ml.linked_movie_id = t.id AND lt.id = ml.link_type_id AND it.id = pi.info_type_id AND pi.person_id = an.person_id AND pi.person_id = ci.person_id AND an.person_id = ci.person_id AND ci.movie_id = ml.linked_movie_id
"""
from moz_sql_parser import parse
parse(sql)