Skip to content

Commit

Permalink
fix: do not import non-query based queries
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Nov 4, 2023
1 parent dca18f3 commit f94eb9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def sync_tables(self, connection, tables=None, force=False):
self.connection = connection
to_sync = self.get_stored_queries() if tables is None else tables
for docname in to_sync:
if not frappe.db.exists("Insights Query", docname):
continue
doc = frappe.get_doc("Insights Query", docname)
# fetch results internally imports them into the db
# also updates the insights table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ def get_selected_tables(self):
def before_fetch(self):
if self.doc.data_source != "Query Store":
return
sub_stored_queries = [t.table for t in self.get_selected_tables()]
sub_stored_queries = [
t.table for t in self.get_selected_tables() if t.table != self.doc.name
]
sync_query_store(sub_stored_queries)

def after_fetch(self, results):
Expand Down

0 comments on commit f94eb9a

Please sign in to comment.