Skip to content

wrong cascading type for field.config bypass native physicalType #1039

@dmaresma

Description

@dmaresma

physical_type = _get_config_value(field, "physicalType")

the cascading of function from :
def convert_to_sql_type(field: Union[SchemaProperty, FieldLike], server_type: str) -> str:
physical_type = _get_physicalType(field)
-->
_get_config_value and then _get_config to try to catch the physicalType wont append cause :
schemaProperty class does't have a field.config

the sql Export will ignore automaticaly the provided physicalType

the _get_config function should looklike this :

    """Get the config from a field, handling both ODCS and DCS."""
    if isinstance(field, SchemaProperty):
        config = field.model_dump()
        if field.customProperties:
            config.update({cp.property: cp.value for cp in field.customProperties})
        return config
    return None```

or 

implement a dedicated function like _get_type for the physicalType only :
```def _get_physicalType(field: Union[SchemaProperty, FieldLike]) -> Optional[str]:
    """Get the type from a field, handling both ODCS and DCS. only physicalType for accuracy."""
    if field and isinstance(field, SchemaProperty):
        # Prefer physicalType for accurate type mapping
        if field.physicalType:
            return field.physicalType
    if field and field.type:
        return field.type
    return None```

At now the `convert_to_sql_type` ignore the physicalType and use the logicaType by default, 

At the End all the test using the convert_to_sql_type `Drift` from dcs to odcs 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions