Created
June 3, 2014 03:20
-
-
Save yubessy/d966dd90b6b46787cdbb to your computer and use it in GitHub Desktop.
Pythonコードの中に複数行SQLを書く ref: http://qiita.com/yubessy/items/86032d332ac86c1abe67
This file contains 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
sql_stmt = "CREATE TABLE Test(" \ | |
"id INTEGER PRIMARY KEY, " \ | |
"val TEXT NOT NULL)" |
This file contains 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
sql_stmt = """CREATE TABLE Test( | |
id INTEGER PRIMARY KEY, | |
val TEXT NOT NULL)""" |
This file contains 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
sql_stmt = ( | |
"CREATE TABLE Test(" | |
"id INTEGER PRIMARY KEY," | |
"val TEXT NOT NULL)") |
This file contains 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
sql_stmt = ( | |
"SELECT * FROM Test" # 最後に空白を入れないと次の行と繋がって構文エラーになる | |
"WHERE id < 10") |
This file contains 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
sql_stmt = " ".join(( | |
"SELECT * FROM Test", | |
"WHERE id < 10")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment