Skip to content

Commit bc56e2f

Browse files
committed
Fix all
1 parent 6cd1a1a commit bc56e2f

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

datajunction-server/datajunction_server/database/column.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def copy(self) -> "Column":
168168
"""
169169
Returns a full copy of the column
170170
"""
171-
print("Copying column:", self.name, self.type)
172171
return Column(
173172
order=self.order,
174173
name=self.name,

datajunction-server/datajunction_server/models/column.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from sqlalchemy import TypeDecorator
99
from sqlalchemy.types import Text
1010

11-
from datajunction_server.sql.parsing.backends.exceptions import DJParseException
1211
from datajunction_server.enum import StrEnum
1312
from datajunction_server.sql.parsing.types import ColumnType
1413

@@ -37,12 +36,7 @@ def process_bind_param(self, value: ColumnType, dialect):
3736
def process_result_value(self, value, dialect):
3837
from datajunction_server.sql.parsing.backends.antlr4 import parse_rule
3938

40-
if not value:
41-
return value
42-
try:
43-
return parse_rule(value, "dataType")
44-
except DJParseException:
45-
return value
39+
return parse_rule(value, "dataType")
4640

4741

4842
class ColumnAttributeInput(BaseModel):

datajunction-server/datajunction_server/models/cube.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ def type_string(cls, values):
4848
Extracts the type as a string
4949
"""
5050
if isinstance(values, dict):
51-
data = values
52-
else:
53-
data = values.__dict__ if hasattr(values, "__dict__") else values
51+
return values
5452

55-
if "node_revision" in data:
56-
data["node_name"] = data["node_revision"].name
53+
# Create a new dict, don't modify the original object or it could
54+
# overwrite the SQLAlchemy model
55+
data = {}
56+
if hasattr(values, "__dict__"):
57+
data.update(values.__dict__)
58+
59+
if hasattr(values, "node_revision"):
60+
data["node_name"] = values.node_revision.name
5761
data["type"] = (
58-
data["node_revision"].type
59-
if data["node_revision"].type == NodeType.METRIC
62+
values.node_revision.type
63+
if values.node_revision.type == NodeType.METRIC
6064
else NodeType.DIMENSION
6165
)
6266
return data

datajunction-server/datajunction_server/models/node.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ class ColumnOutput(BaseModel):
701701

702702
@field_validator("type", mode="before")
703703
def extract_type(cls, raw):
704-
print("ColumnOutput type raw:", raw)
705704
return str(raw)
706705

707706

0 commit comments

Comments
 (0)