【发布时间】:2018-09-21 05:16:49
【问题描述】:
假设有一个sql脚本:
select *
from (
select col1 from test.test_a join test.test_a1 on a.col1 = a1.col1) a
left join test.test_b b
on a.col1 = b.col2
left join
test.test_c c
on b.col2 = c.col3
left jon
(select
col4
from
test.test_d) d
on c.col3 = d.col4
我正在阅读 this question 并尝试使用 python 在上面的脚本中提取“from”或“join”之后的所有表名。
困难是我正在逐行处理脚本,但表名和关键字可能NOT在同一行。
那么如何从脚本中提取这样的表名呢?任何建议表示赞赏。
【问题讨论】:
-
它和python有什么关系?