When formatting, black ends up concatenating multiline SQL statements:
Before formatting:
df = pd.read_sql(
"SELECT TOP 1000 * " \
"FROM [ETZ3BSC1].[NT0001\BD9524].[AA_Trades]", conn
)
After formatting:
df = pd.read_sql(
"SELECT TOP 1000 * " "FROM [ETZ3BSC1].[NT0001\BD9524].[AA_Trades]", conn
)
Is it possible to enable multi-line SQL statement support? Adding # fmt: off
and # fmt: on
before and after the code works but I'm interested in multi-line SQL code support, not disabling the formatter completely.
Python's multiline string syntax should work here:
df = pd.read_sql("""
SELECT TOP 1000 *
FROM [ETZ3BSC1].[NT0001\BD9524].[AA_Trades]""", conn
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.