File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
include/sqlserver/macros/adapters Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
- from typing import ClassVar , Dict
1
+ from typing import Any , ClassVar , Dict
2
2
3
3
from dbt .adapters .base import Column
4
4
@@ -11,3 +11,10 @@ class SQLServerColumn(Column):
11
11
"INTEGER" : "INT" ,
12
12
"BOOLEAN" : "BIT" ,
13
13
}
14
+
15
+ @classmethod
16
+ def string_type (cls , size : int ) -> str :
17
+ return f"varchar({ size if size > 0 else 'MAX' } )"
18
+
19
+ def literal (self , value : Any ) -> str :
20
+ return "cast('{}' as {})" .format (value , self .data_type )
Original file line number Diff line number Diff line change 55
55
{%- endcall -%}
56
56
57
57
{% endmacro %}
58
+
59
+
60
+ {% macro sqlserver__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}
61
+ {% call statement('add_drop_columns') -%}
62
+ {% if add_columns %}
63
+ alter {{ relation.type }} {{ relation }}
64
+ add {% for column in add_columns %}{{ column.name }} {{ column.data_type }}{{ ', ' if not loop.last }}{% endfor %};
65
+ {% endif %}
66
+
67
+ {% if remove_columns %}
68
+ alter {{ relation.type }} {{ relation }}
69
+ drop column {% for column in remove_columns %}{{ column.name }}{{ ',' if not loop.last }}{% endfor %};
70
+ {% endif %}
71
+ {%- endcall -%}
72
+ {% endmacro %}
You can’t perform that action at this time.
0 commit comments