SQL cells should ignore commented interpolated parameters
nachocab opened this issue · comments
On a SQL cell like this one, commenting an interpolated parameter should not give an error:
![CleanShot 2023-07-28 at 14 18 33@2x](https://private-user-images.githubusercontent.com/27538/256819250-4a45e7e6-6826-4924-aa82-67551b708d92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNzk4NTMsIm5iZiI6MTcxOTA3OTU1MywicGF0aCI6Ii8yNzUzOC8yNTY4MTkyNTAtNGE0NWU3ZTYtNjgyNi00OTI0LWFhODItNjc1NTFiNzA4ZDkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDE4MDU1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgwOGU5ODcyYjhlMWYyZTgyZjMzMTA3ODk0OGYwMDNhMGM0MDdlZGZlNDRmYmNjYTg2NWJmZTNjOTMwMTAzMDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TXQsR_u1NeK7fvAzAvOboaIcLPzxfONfPaWTVES_Ec4)
I don't think we can prevent that, as it would require parsing the query syntax to determine where the interpolation happens.
I understand, but remember that comments in SQL are easier than in JS. It would be as simple as running this regex: query.replace(/--.+/g, '')
No, multiline comments (/* ... */
) are also supported.
Oh, I didn't know that. Anyway, handling single line comments would be already be an improvement