hi all, I'm having an error while ingesting MSSQL ...
# ingestion
g
hi all, I'm having an error while ingesting MSSQL data into the datahub. It says db connection url couldn't be parsed. Below is the error returned. Also I shared my ingestion yaml file here. Am I missing something?
source:
type: mssql
config:
# Coordinates
host_port: '192.168.1.1:1433'
database: 'prod-db-2'
scheme: 'PROD-DB2'
# Credentials
username: db2admin
password: "password*"
sink:
type: "datahub-rest"
config:
server: "<http://localhost:6080>"
transformers:
- type: "simple_add_dataset_tags"
config:
tag_urns:
- "urn:li:tag:db2"
Copy code
ArgumentError: Could not parse rfc1738 URL from string '<PROD-DB2://db2admin:password%2A@192.168.1.1:1433/prod-db-2>'
[2022-07-06 01:26:39,723] INFO     {datahub.entrypoints:176} - DataHub CLI version: 0.8.34.2 at /usr/local/lib/python3.8/dist-packages/datahub/__init__.py
[2022-07-06 01:26:39,723] INFO     {datahub.entrypoints:179} - Python version: 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] at /usr/bin/python3 on Linux-5.4.0-104-generic-x86_64-with-glibc2.29
[2022-07-06 01:26:39,723] INFO     {datahub.entrypoints:182} - GMS config {'models': {}, 'versions': {'linkedin/datahub': {'version': 'v0.8.34', 'commit': 'f847fa31c9010bbb9df0d13ae7660e59083ea03e'}}, 'managedIngestion': {'defaultCliVersion': '0.8.34.1', 'enabled': True}, 'statefulIngestionCapable': True, 'supportsImpactAnalysis': True, 'telemetry': {'enabledCli': True, 'enabledIngestion': False}, 'datasetUrnNameCasing': False, 'retention': 'true', 'noCode': 'true'}
I suspect maybe sqlalchemy cannot accept a password which has a special character.
It seems I also forget to add the below lines to define driver used for db connection.
Copy code
uri_args:
      driver: "ODBC Driver 17 for SQL Server"
      Encrypt: "yes"
      TrustServerCertificate: "Yes"
      #ssl: "True"
      autocommit: "True"
Now I'm getting the below error :
Copy code
ModuleNotFoundError: No module named 'pyodbc'
installed pyodbc using
sudo pip install pyodbc
and now getting this error :
Copy code
Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
h
I believe, you will need to download and install ODBC driver for SQL Server first. Follow instructions for your OS - https://docs.microsoft.com/en-gb/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16
g
Yes, already installed and I got different error message.
h
Hey @gray-architect-29447 what was the error ? Were you able to run ingestion successfully ?
Also, in earlier recipe without odbc, you should omit this line .
scheme: 'PROD-DB2'
scheme is automatically set to
mssql+pytds
or
mssql+pyodbc
depending on whether odbc is used.
g
Hi @hundreds-photographer-13496, I just found that MSSQL server authentication mode was set to Windows Integrated Authentication. So I've changed it to the mixed mode. Now I'm getting
"could not find a login matching the name provided sql connection"
error. Since, the user is Windows domain user and has @company.local prefix, I need to change username to : "COMPANYLOCAL\dbadmin". But it will also result an error.
when I change the username to "COMPANYLOCAL\dbadmin" it prints out the error "`ScannerError: while scanning a double-quoted scalar`
in "<file>", line 9, column 15
`found unknown escape character 'k'`"
h
can you try escaping the backslash like this "COMPANYLOCAL\\dbadmin"
g
It says login failed for user COMPANYLOCAL\\dbadmin
h
Seems we are past the earlier error of "`could not find a login matching the name provided sql connection`"
any additional useful details in error log ?
g
here's the log file from MSSQL server
Logged in successfully, just created a new sql server user /not windows domain user/, and set owner of the database
Successfully ingested 1 of the database. Rest one got an error :
ProgrammingError: (pyodbc.ProgrammingError) ('ODBC SQL type -150 is not yet supported.  column-index=2  type=-150', 'HY106'
I don't know why but whenever I do something /not only datahub/ I always face an issue.
h
Oh ! Looks like there an open github issue for this - https://github.com/datahub-project/datahub/issues/5344
🙂 1
g
nice, gonna follow this issue
h
Cool, meanwhile, you could also try ingestion without using odbc, by removing
use_odbc
and
uri_args
and check if it works. (you will also need to remove
scheme
if you haven't already)
g
woohoo, followed your guide and data ingested successfully. But I don't get how it's done without odbc, at the beginning it was asking for to use odbc. Now it's working without odbc
h
Yay!! did it ask for odbc explicitly ?? I thought you had to switch to it due to url parsing error
g
It didn't ask for odbc explicitly. Everything went great without any error. Thanks 🙂
h
great !
f
@hundreds-photographer-13496 Hi Mayuri, I am stuck with a similar error. I couldn't get past the login for windows authentication. (Sql auth works fine ) Unfortunately, I cannot use sql logins.
can you suggest how to make windows auth work with odbc please?
h
Hi @flaky-soccer-57765 are you getting same error as this github issue ? Looks like its still open.
f
@hundreds-photographer-13496 No, I am looking for general guidance around making windows authentication work. As of now, only SQL server login works. Attaching the error log and recipe used.
h
Hi @flaky-soccer-57765 looks like you are executing the recipe on managed ingestion. Can you confirm - if its running, when using datahub cli alone?
f
@hundreds-photographer-13496 I haven't tried that. Will try and come back.
It feels like it mistakes windows auth details as sql server login detail when it connects to the server. @hundreds-photographer-13496 Am I missing any parameter in the recipe that differentiates windows auth from sql auth please?
ignore the above error. the latest is no kerberos found.
h
Hi @flaky-soccer-57765 - the second error kerberos not found is for managed ingestion. I would suggest - to first successfully execute recipe with cli ingestion on local and then attempt managed ingestion, because managed ingestion runs on a separate container, which is an added complexity to get it to work.