Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Temp Table SQL for MSSQL #1110

Closed
rlshuhart opened this issue Feb 24, 2020 · 2 comments · Fixed by #1269
Closed

Invalid Temp Table SQL for MSSQL #1110

rlshuhart opened this issue Feb 24, 2020 · 2 comments · Fixed by #1269

Comments

@rlshuhart
Copy link
Contributor

rlshuhart commented Feb 24, 2020

There looks to be similar open issue (#1012), but opening this for the specific invalid syntax for temp tables with mssql.

When following great_expectations init and using a relational database option with MSSQL connection, the following error occurs:

 "[42000] [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Unknown object type 'TEMPORARY' used in a CREATE, DROP, or ALTER statement. (343) (SQLExecDirectW)")

I'll see if I can suggest a PR to fix this.

@kepiej
Copy link
Contributor

kepiej commented Apr 3, 2020

I encountered the same problem. I think it can be fixed by adding another elif clause to create_temporary_table() in sqlalchemy_dataset.py as follows:

elif self.engine.dialect.name == "mssql":
     custom_sqlmod = custom_sql.split('from')
     stmt = (custom_sqlmod[0] + "into #{table_name} from" + custom_sqlmod[1]).format(table_name=table_name)

Temporary tables in MSSQL are indicated by #.

@rlshuhart
Copy link
Contributor Author

I've been buried. Thanks @kepiej!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants