Skip to content
This repository has been archived by the owner on May 29, 2021. It is now read-only.

Documentation note about making sure 'ODBC Driver 17 for SQL Server' is installed on local machine #5

Closed
curious-bryan opened this issue Aug 9, 2019 · 2 comments

Comments

@curious-bryan
Copy link
Contributor

curious-bryan commented Aug 9, 2019

@jacobm001 thank you for developing this dbt database adapter for MSSQL! Fantastic contribution!

It may be helpful to some newbie dbt users to have a reminder like:

Remember to check that 'ODBC Driver 17 for SQL Server' is installed on your local machine.

I had this issue. 🤦‍♂

If you agree, here are some links.
If you disagree, I totally understand. It is not your job to remind others of the basics.

jacobm001 added a commit that referenced this issue Aug 19, 2019
As noted in issue #5, the use of the `driver` variable was not particularly clear. I've added some info to try and explain that configuration better.
@jacobm001
Copy link
Owner

@curious-bryan: I've added some details into the readme to address this confusion. I think that should cover it.

@curious-bryan
Copy link
Contributor Author

@jacobm001 Nice! Well said!

ThomasLaPiana pushed a commit to degreed/dbt-azuresa that referenced this issue Feb 6, 2020
* Fixed issue jacobm001#6.

This issue was caused by the `package_data` variable being setup incorrectly in `setup.py`. Apparently the file listing is **not** recursive, which caused the `sdist` files to lack several macro overrides needed to function.

* Added a note about the ODBC driver

As noted in issue jacobm001#5, the use of the `driver` variable was not particularly clear. I've added some info to try and explain that configuration better.

* altered mssql__create_view_as macros

Looks like this issue is being caused by the `mssql__create_view_as` macro. It works fine if the sql it's provided does not contain a CTE. If it does, sql server considers it a syntax error.

This commit removes the parenthesis wrapping the `{{ sql }}` portion.

* Fixed CTEs with insert into statements

SQL Server's `insert into` syntax isn't nearly as forgiving as in other databases. In the previous version I had created a cte as apart of the into statement that could later be referenced.

This worked so long as your source model didn't contain a CTE of its own. If it did, that put a CTE declaration inside another CTE which broke everything. I've taken a que from the dbt-sqlserver package and am now creating a "temporary" view to handle the issue.

Thanks @mikaelene for the example.

* incremented version number

* Update README.md

* updated .gitignore

* delt with empty column names

It appears that issue jacobm001#10 is caused by MSSQL not returning default column names for aggregate functions through the odbc library. When the `''` column name hits the agate library, an error is thrown.

To handle this behavior, I've overridden the class method, `get_result_from_cursor()`. The new method loops through all the column names and replaces any instances of `''` with `unnamed_column-{i}`. This should provide a simple work around that the user doesn't really see, but is also very easy for the user to avoid if it's undesired behaivor.

* incremented version

* Update README.md

* initial commit

* added catalog

* added work from https://github.com/norton120/dbt-azuredatawarehouse

* moved to explicit varchar size per https://docs.microsoft.com/en-us/azure/sql-data-warehouse/sql-data-warehouse-tables-data-types

* handle empty string column name from scalar

* update README to match dockerfile

* added sample profile.yml

* clean up git conflict noise in readme

* known issues in readme

* added process_results class method and updated sql connection type

Co-authored-by: Jacob Mastel <[email protected]>
Co-authored-by: Isaac Chavez <[email protected]>
Co-authored-by: Ethan Knox <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants