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

MSSQL Usage query error for version SQL Server 2019 #14100

Closed
ulixius9 opened this issue Nov 24, 2023 · 0 comments · Fixed by #14101
Closed

MSSQL Usage query error for version SQL Server 2019 #14100

ulixius9 opened this issue Nov 24, 2023 · 0 comments · Fixed by #14101
Assignees
Labels
bug Something isn't working Ingestion

Comments

@ulixius9
Copy link
Member

Affected module
Ingestion Framework

Describe the bug
When running usage for SQL Server 2019 (Collation: Latin1_General_BIN, which is Case Sensitive) usage fails with following error

[2023-11-24T01:57:46.244+0000] {status.py:65} WARNING - Encountered exception running step [<metadata.ingestion.source.database.mssql.lineage.MssqlLineageSource object at 0x7ff8e91fd7f0>]: [(pymssql._pymssql.ProgrammingError) (208, b"Invalid object name 'sys.Dm_exec_sql_text'.DB-Lib error message 20018, severity 16:\nGeneral SQL Server error: Check messages from the SQL Server\n")
[SQL:
SELECT TOP 50
  db.NAME database_name,
  t.text query_text,
  s.last_execution_time start_time,
  DATEADD(s, s.total_elapsed_time/1000, s.last_execution_time) end_time,
  s.total_elapsed_time/1000 duration,
  NULL schema_name,
  NULL query_type,
  NULL user_name,
  NULL aborted
FROM [sys.dm](http://sys.dm/)_exec_cached_plans AS p
INNER JOIN [sys.dm](http://sys.dm/)_exec_query_stats AS s
  ON p.plan_handle = s.plan_handle
CROSS APPLY sys.Dm_exec_sql_text(p.plan_handle) AS t
INNER JOIN sys.databases db
  ON db.database_id = t.dbid
WHERE s.last_execution_time between '2023-11-23 00:00:00' and '2023-11-25 00:00:00'
    AND t.text NOT LIKE '/* {"app": "OpenMetadata", %%} */%%'
    AND t.text NOT LIKE '/* {"app": "dbt", %%} */%%'
    AND p.objtype != 'Prepared'
        AND (
            lower(t.text) LIKE '%%select%%into%%'
            OR lower(t.text) LIKE '%%insert%%into%%select%%'
            OR lower(t.text) LIKE '%%update%%'
            OR lower(t.text) LIKE '%%merge%%'
        )
ORDER BY s.last_execution_time DESC
]
(Background on this error at: https://sqlalche.me/e/14/f405[)](https://sqlalche.me/e/14/f405))]
@ulixius9 ulixius9 added bug Something isn't working Ingestion labels Nov 24, 2023
@ulixius9 ulixius9 self-assigned this Nov 24, 2023
@harshach harshach moved this to Ingestion - Bugs & Minor Features in Release 1.2.3 Nov 24, 2023
@harshach harshach moved this from Ingestion - Bugs & Minor Features to Done in Release 1.2.3 Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Ingestion
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant