-
Notifications
You must be signed in to change notification settings - Fork 79
Description
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:
-aor--apiId: The API ID (e.g.,shared_databricks)-cor--connectionId: The connection ID (GUID)-tor--table: The table name (e.g.,schema.tablename)-dor--dataset: The catalog/dataset name (e.g.,my_catalog)
Steps to Reproduce
- Initialize a Power Apps Code app using
pac code init - Add a Databricks data source using the command:
pac code add-data-source -a shared_databricks -c <connectionId> -t "schema.tablename" -d "catalog_name"
- Check the generated files in:
src/generated/services/<ServiceFile>.ts.power/schemas/appschemas/dataSourcesInfo.tspower.config.json
- Run the application and attempt to load data from the Databricks source
- 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
dataSourceNamein 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:
-
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'; }
-
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", // ... } }
-
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:
-
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';
-
Update
.power/schemas/appschemas/dataSourcesInfo.tsto match:export const dataSourcesInfo = { "catalog_name_schema_tablename": { // Must match service file "tableId": "catalog_name.schema.tablename", "version": "", "primaryKey": "", "dataSourceType": "Connector", "apis": {} } }
-
Update
power.config.jsonin 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.