From c6542749cdfc715d70785dfc0631566b60caf218 Mon Sep 17 00:00:00 2001 From: Aradhya-Tripathi Date: Thu, 14 Oct 2021 14:55:16 +0530 Subject: [PATCH] feat: prepending tab to table name for UPDATE and INSERT --- frappe/query_builder/builder.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frappe/query_builder/builder.py b/frappe/query_builder/builder.py index 5060331914..630cfea222 100644 --- a/frappe/query_builder/builder.py +++ b/frappe/query_builder/builder.py @@ -28,6 +28,17 @@ class MariaDB(Base, MySQLQuery): table = cls.DocType(table) return super().from_(table, *args, **kwargs) + @classmethod + def into(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().into(table, *args, **kwargs) + + @classmethod + def update(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().update(table, *args, **kwargs) class Postgres(Base, PostgreSQLQuery): field_translation = {"table_name": "relname", "table_rows": "n_tup_ins"} @@ -58,3 +69,15 @@ class Postgres(Base, PostgreSQLQuery): table = cls.DocType(table) return super().from_(table, *args, **kwargs) + + @classmethod + def into(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().into(table, *args, **kwargs) + + @classmethod + def update(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().update(table, *args, **kwargs) \ No newline at end of file