mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-30 18:17:53 +00:00
close-connection-after-each-batch-using-with (#6641)
This commit is contained in:
parent
555962dfd3
commit
77ad1b1c87
@ -49,7 +49,6 @@ class UsageSource(Source[TableQuery], ABC):
|
||||
self.start, self.end = get_start_and_end(self.source_config.queryLogDuration)
|
||||
self.analysis_date = self.end
|
||||
self.report = SQLSourceStatus()
|
||||
self.engine = get_connection(self.connection)
|
||||
|
||||
def prepare(self):
|
||||
return super().prepare()
|
||||
@ -117,7 +116,8 @@ class UsageSource(Source[TableQuery], ABC):
|
||||
f"Scanning query logs for {(self.start+timedelta(days=i)).date()} - {(self.start+timedelta(days=i+1)).date()}"
|
||||
)
|
||||
try:
|
||||
rows = self.engine.execute(
|
||||
with get_connection(self.connection).connect() as conn:
|
||||
rows = conn.execute(
|
||||
self.get_sql_statement(
|
||||
start_time=self.start + timedelta(days=i),
|
||||
end_time=self.start + timedelta(days=i + 1),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user