sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

Any Tutorial on Subclassing ReindentFilter or AlignedIndentFilter for customing parsing?

Open mkmoisen opened this issue 5 years ago • 3 comments

I would like to create my own alternate to ReindentFilter and AlignedIndentFilter.

I played around a bit with subclassing AlignedIndentFilter and making changes, but am now stuck.

Is there any tutorial available that explains how we can make our own extensions?

mkmoisen avatar Dec 15 '20 16:12 mkmoisen

I also played a little with this. I created a super class which just splits the statement and reimplemented the two filters ReindentFilter and AlignedIndentFilter as subclasses of the first as long as they basically perform the same splitting, just with a different offset. @mkmoisen: If you want I can share with you a branch with the solution to show you the new structure

f-raffa avatar Jul 06 '21 17:07 f-raffa

@f-raffa Yes please, would you kindly share your branch?

mkmoisen avatar Jul 07 '21 14:07 mkmoisen

@mkmoisen: https://github.com/f-raffa/sqlparse/tree/new-splitting-and-grouping-logic let me know if you can access it

f-raffa avatar Jul 09 '21 17:07 f-raffa