Skip to content

MSSQL: Column name mapping breaks for certain naming patterns #571

@amitdeshmukh

Description

@amitdeshmukh

Description

When using GraphJin with MSSQL (SQL Server), certain column names are incorrectly mapped in the generated SQL. GraphJin appears to apply a camelCase transformation that strips underscores from some column names, producing SQL column names that don't match the actual database schema.

Environment

  • GraphJin version: 3.16.2
  • Database: Microsoft SQL Server 2016 (named instance)
  • OS: macOS (darwin)

Reproduction

Given an MSSQL table Theatre_Master with columns like Is_Active, Is_DCI, property_id, Equipment_Type:

Works correctly

{ theatre_master(limit: 3) { theater_id theater_name city ckt_id region_id } }

These columns map correctly:

  • theater_idTheater_Id
  • theater_nameTheater_Name
  • ckt_idCkt_Id
  • region_idRegion_ID

Broken columns

{ theatre_master(limit: 3) { is_active is_dci property_id equipment_type } }
GraphQL field GraphJin generates Actual DB column Error
is_active IsActive Is_Active mssql: Invalid column name 'IsActive'
is_dci IsDCI Is_DCI mssql: Invalid column name 'IsDCI'
property_id propertyId property_id mssql: Invalid column name 'propertyId'
equipment_type (not found) Equipment_Type field 'equipment_type' is not a column or a function

The same pattern occurs across multiple tables — any column with is_ prefix or a lowercase word_word pattern gets incorrectly camelCased.

Expected behavior

GraphJin should use the exact column names as introspected from INFORMATION_SCHEMA.COLUMNS (or sys.columns) when generating SQL for MSSQL. The camelCase transformation should not be applied to MSSQL column names since MSSQL schemas commonly use mixed naming conventions (PascalCase_With_Underscores, lowercase_with_underscores, Is_PascalCase).

Config

Using auto-discovery (tables: []) with no explicit column configuration:

databases:
  default:
    type: mssql
    host: 10.25.5.25
    port: 5205
    dbname: VMPL_DATA
    user: myuser
    password: mypass

Workaround

Currently using node-mssql for queries involving affected columns. Would prefer to use GraphJin for all reads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions