Skip to content

Commit

Permalink
build(maxcompute): 更新适配器版本为 1.9.0-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxin-tech committed Jan 15, 2025
1 parent cf2edbe commit 428ce0e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/maxcompute/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.9.0-alpha"
version = "1.9.0-alpha.1"
5 changes: 2 additions & 3 deletions dbt/adapters/maxcompute/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from dbt.adapters.contracts.relation import RelationType
from dbt.adapters.protocol import AdapterConfig
from dbt.adapters.sql import SQLAdapter
from dbt.context.providers import RuntimeConfigObject
from dbt_common.contracts.constraints import ConstraintType
from dbt_common.exceptions import DbtRuntimeError
from dbt_common.utils import AttrDict
Expand Down Expand Up @@ -557,12 +556,12 @@ def mc_render_raw_columns_constraints(
return rendered_column_constraints

@available
def run_raw_sql(self, sql: str, configs: RuntimeConfigObject) -> None:
def run_raw_sql(self, sql: str, configs: Any) -> None:
hints = {}
default_schema = None
if configs is not None:
default_schema = configs.get("schema")
sql_hints = configs.get("sql_hints")
if sql_hints:
hints.update(sql_hints)
self.get_odps_client().execute_sql(sql=sql, hints=hints, default_schema=default_schema)
self.get_odps_client().execute_sql(sql=sql, hints=hints, default_schema=default_schema)
11 changes: 6 additions & 5 deletions dbt/adapters/maxcompute/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,21 @@ def remove_comments(input_string):
# operation = remove_comments(operation)
parameters = param_normalization(parameters)
operation = replace_sql_placeholders(operation, parameters)

def parse_settings(sql):
properties = {}
index = 0

while True:
end = sql.find(';', index)
end = sql.find(";", index)
if end == -1:
break
s = sql[index:end]
if re.match(r'(?i)^\s*SET\s+.*=.*?\s*$', s):
if re.match(r"(?i)^\s*SET\s+.*=.*?\s*$", s):
# handle one setting
i = s.lower().find('set')
pair_string = s[i + 3:]
pair = pair_string.split('=')
i = s.lower().find("set")
pair_string = s[i + 3 :]
pair = pair_string.split("=")
properties[pair[0].strip()] = pair[1].strip()
index = end + 1
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
SELECT *
FROM {{ source }}
)
{% endmacro %}
{% endmacro %}

0 comments on commit 428ce0e

Please sign in to comment.