Closed fgarzadeleon closed 9 months ago
As far as I can tell this helper function is only designed to replace the table reference and not prefixed references to columns in that table, which wouldn't be necessary when using an alias anyway.
I can't readily think of a solution to this one, ideas welcome!
Easiest would be to add documentation to always alias your tables but a fix that considers this in the package would be best.
Thanks for filing that bug @fgarzadeleon! @thecasper2 I can have a look the upcoming days. I think the library we use (sqlglot) should be able to help us out there.
@thecasper2 @fgarzadeleon I might have found a solution: https://github.com/DeepLcom/sql-mock/pull/44
Using a simple query:
With models:
Because table
a
does not havea AS a
this fails. Because the table has now been replaced withslq_mock__a
but it is still being referenced asa
ina.col1
.