Skip to content

[Bug] Azure Databricks Data Source Naming Mismatch Between Generated Files #171

@Ogoben

Description

@Ogoben

Describe the bug

When adding Databricks data sources using the Power Platform CLI (pac code add-data-source), the generated service files use a different naming convention than the configuration files, causing data loading failures in the application.

The Power Platform CLI command for adding a Databricks data source:
pac code add-data-source -a shared_databricks -c <connectionId> -t "<tableName>" -d "<catalog>"

Parameters:

  • -a or --apiId: The API ID (e.g., shared_databricks)
  • -c or --connectionId: The connection ID (GUID)
  • -t or --table: The table name (e.g., schema.tablename)
  • -d or --dataset: The catalog/dataset name (e.g., my_catalog)

Steps to Reproduce

  1. Initialize a Power Apps Code app using pac code init
  2. Add a Databricks data source using the command:
    pac code add-data-source -a shared_databricks -c <connectionId> -t "schema.tablename" -d "catalog_name"
  3. Check the generated files in:
    • src/generated/services/<ServiceFile>.ts
    • .power/schemas/appschemas/dataSourcesInfo.ts
    • power.config.json
  4. Run the application and attempt to load data from the Databricks source
  5. Observe that data fails to load

Expected behavior

After running pac code add-data-source, all generated and configuration files should use consistent naming conventions for the data source:

  • The dataSourceName in service files (e.g., src/generated/services/Catalog_name_schema_tablenameService.ts)
  • The keys in dataSourcesInfo.ts
  • The datasource names in power.config.json

All three should reference the same identifier so the data client can correctly map requests to the appropriate data source.

Actual behavior

The generated files use inconsistent naming conventions:

  1. Service Files (src/generated/services/<ServiceFile>.ts) use catalog-based naming:

    export class Catalog_name_schema_tablenameService {
      private static readonly dataSourceName = 'catalog_name_schema_tablename';
    }
  2. dataSourcesInfo.ts (.power/schemas/appschemas/dataSourcesInfo.ts) may use a different naming pattern:

    export const dataSourcesInfo = {
      "old_prefix_schema_tablename": {
        "tableId": "catalog_name.schema.tablename",
        // ...
      }
    }
  3. power.config.json may also use yet another naming pattern in the dataSources array

This mismatch causes the data client to fail when looking up the data source, resulting in no data being loaded. The application builds successfully but fails at runtime.

Screenshots or Error Messages

Environment information

  • Framework, build tool or relevant package used: [React,Vite, Webpack, etc]
  • Connector: shared_databricks (Databricks connector)

Additional context

Workaround/Fix

Manually update the configuration files to ensure consistent naming across all three locations:

  1. Identify the correct naming from the generated service file:

    // In src/generated/services/Catalog_name_schema_tablenameService.ts
    private static readonly dataSourceName = 'catalog_name_schema_tablename';
  2. Update .power/schemas/appschemas/dataSourcesInfo.ts to match:

    export const dataSourcesInfo = {
      "catalog_name_schema_tablename": {  // Must match service file
        "tableId": "catalog_name.schema.tablename",
        "version": "",
        "primaryKey": "",
        "dataSourceType": "Connector",
        "apis": {}
      }
    }
  3. Update power.config.json in both the dataSources array and dataSets object:

    {
      "dataSources": [
        "catalog_name_schema_tablename"  // Must match service file
      ],
      "dataSets": {
        "catalog_name": {
          "dataSources": {
            "catalog_name_schema_tablename": {  // Must match service file
              "tableName": "schema.tablename"
            }
          }
        }
      }
    }

After these manual corrections, the data loads correctly.

Metadata

Metadata

Assignees

Labels

Fix rolling outWe start the rollout with the fix for this issue.bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions