Skip to content

Commit

Permalink
fix: compatibility with v14
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Nov 20, 2024
1 parent ebf2d37 commit ace1b2d
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions insights/insights/doctype/insights_table_v3/insights_table_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hashlib import md5

import frappe
from frappe.model.document import Document, bulk_insert
from frappe.model.document import Document

from insights.insights.doctype.insights_data_source_v3.data_warehouse import Warehouse
from insights.utils import InsightsDataSourcev3
Expand All @@ -32,16 +32,36 @@ def autoname(self):

@staticmethod
def bulk_create(data_source: str, tables: list[str]):
table_docs = []
tables = []
for table in tables:
doc = frappe.new_doc("Insights Table v3")
doc.name = get_table_name(data_source, table)
doc.data_source = data_source
doc.table = table
doc.label = table
table_docs.append(doc)

bulk_insert("Insights Table v3", table_docs, ignore_duplicates=True)
tables.append(
[
get_table_name(data_source, table),
data_source,
table,
table,
frappe.utils.now(),
frappe.utils.now(),
frappe.session.user,
frappe.session.user,
]
)

frappe.db.bulk_insert(
"Insights Table v3",
[
"name",
"data_source",
"table",
"label",
"creation",
"modified",
"modified_by",
"owner",
],
tables,
ignore_duplicates=True,
)

@staticmethod
def get_ibis_table(data_source, table_name, use_live_connection=False):
Expand Down

0 comments on commit ace1b2d

Please sign in to comment.