Skip to main content
 

1, II 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)) ".

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

2, HowHow 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; "

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; ".

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

3, ie. I want to change the format of subquery without changing "count(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.

1, 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)) ".

2, 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; ".

3, 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.

 

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.

Source Link

Python sqlparse _ New line after ( in subquery

1, 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)) ".

2, 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; ".

3, 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.