mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 09:22:14 +00:00
MINOR: fix sql lineage with timezone change (#16685)
* skip mssql test for python * fixed mssql lineage
This commit is contained in:
parent
d6f8836755
commit
955ed5afe1
@ -17,6 +17,11 @@ from metadata.ingestion.source.database.mssql.query_parser import MssqlQueryPars
|
||||
|
||||
|
||||
class MssqlLineageSource(MssqlQueryParserSource, LineageSource):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.start = self.start.replace(tzinfo=None)
|
||||
self.end = self.end.replace(tzinfo=None)
|
||||
|
||||
sql_stmt = MSSQL_SQL_STATEMENT
|
||||
|
||||
filters = """
|
||||
|
@ -216,11 +216,21 @@ class MssqlSource(StoredProcedureMixin, CommonDbSourceService, MultiDBSource):
|
||||
"""
|
||||
start, _ = get_start_and_end(self.source_config.queryLogDuration)
|
||||
query = MSSQL_GET_STORED_PROCEDURE_QUERIES.format(
|
||||
start_date=start,
|
||||
start_date=start.replace(tzinfo=None),
|
||||
)
|
||||
|
||||
try:
|
||||
queries_dict = self.procedure_queries_dict(
|
||||
query=query,
|
||||
)
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
logger.debug(f"Error runnning query:\n{query}")
|
||||
self.status.failed(
|
||||
StackTraceError(
|
||||
name="Stored Procedure",
|
||||
error=f"Error trying to get stored procedure queries: {ex}",
|
||||
stackTrace=traceback.format_exc(),
|
||||
)
|
||||
)
|
||||
return {}
|
||||
|
||||
return queries_dict
|
||||
|
@ -118,7 +118,7 @@ def pretty_print_time_duration(duration: Union[int, float]) -> str:
|
||||
return f"{seconds}s"
|
||||
|
||||
|
||||
def get_start_and_end(duration: int = 0):
|
||||
def get_start_and_end(duration: int = 0) -> Tuple[datetime, datetime]:
|
||||
"""
|
||||
Method to return start and end time based on duration
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user