django-vue-admin/dvadmin-backend/scripts/__init__.py

14 lines
386 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import os
def getSql(filename):
"""
获取文件内所有sql
:param filename: 例如os.path.join('permission','permission_dept.sql')
:return:
"""
pwd = os.path.join(os.getcwd(), 'scripts', filename)
with open(pwd,'rb') as fp:
content = fp.read().decode('utf8')
return [ele for ele in content.split('\n') if not ele.startswith('--') and ele]