Created
May 3, 2014 14:44
-
-
Save whyvez/e4ecb6dfebbeb435b9ff to your computer and use it in GitHub Desktop.
pipeable util to format sql scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/python | |
| import sys | |
| import sqlparse | |
| # usage cat test.sql | ./format_sql.py > test2.sql | |
| def main(argv): | |
| sql = sys.stdin.read().replace('\n', '') | |
| print sqlparse.format(sql, reindent=True, keyword_case='upper') | |
| if __name__ == "__main__": | |
| main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment