0

I am using " https://github.com/andialbrecht/sqlparse/discussions/761 " My invoke program is "

print(sqlparse.format(first, reindent=True, keyword_case='upper', ofrmt='python', wrap_after=8, indent_after_first=True))

How can I make the result

SELECT dt,
count(1)
FROM
(SELECT dt,
WEEK
FROM fin_dim.dim_m_y23_sixth_weekday_jwm_a)
GROUP BY 1;

to the below

SELECT dt,
count(1)
FROM
(
SELECT dt,
WEEK
FROM fin_dim.dim_m_y23_sixth_weekday_jwm_a
)
GROUP BY 1;
  1. ie. I want to change the format of subquery without changing "count(1)".

Your reply is appreciated.

How can I be an expert in Python sqlparse, any suggestions.

2
  • Have you read the documentation? Please edit your post and use the code mark for your program lines. Commented Jan 11, 2024 at 10:47
  • with sqlglot link , I face the same problem. I want ( aligned with ) when there is subquery, what should I do Commented Jan 12, 2024 at 1:45

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.