1,引入并执行方法
module_name = ".".join(
[ "rule",“packagrName2”, "fileName"])
module = __import__(module_name, globals(), locals(), "fileName")
results = module.execute_rule(schemaName,dbUtil)
注意:module_name的路径是从根目录开始匹配,不是文件的相对目录。
2,被引入代码:
def execute_rule(schemaName,dbUtil):
sql = """select table_name from in xxxxxxx
参考url: https://www.jb51.net/article/128957.htm
archives
=
__import__
('
packageName.fileName',fromlist
=
('
fileName',))
等价于:
module = __import__("packageName.fileName", globals(), locals(), "fileName")