Symptom
- Master Data import jobs created using “Build a Query” work in the source environment but fail after being transported to the target environment.
- Error during job execution: “A SQL error occurred when building the draft model. The data retrieved from the database may have been corrupted. Please check with your SQL database administrator for further details.”
- Error code: CS_SQL_ERROR
- Database error from logs: ERROR: "qadb" does not exist
- Import jobs created using “FreeHand SQL” in the source and then transported run successfully in the target.
- Recreating the same import job using “Build a Query” directly in the target runs successfully.
Environment
SAP Analytics Cloud
Reproducing the Issue
- In the source tenant, create a Master Data import job using “Build a Query”.
- Transport the model/dimension together with its import job to the target tenant.
- In the target tenant, open the transported model/dimension, go to Data Management, and run or preview the transported import job.
- Observe that the job fails with a SQL error.
- Create the same import job using “FreeHand SQL” in the source tenant, transport it, and observe it runs successfully in the target.
- Create the same import job using “Build a Query” directly in the target tenant and observe it runs successfully.
Cause
The query transport and editing functionality for "Build a Query" Master Data import jobs expects the underlying database structures in the source and target systems to be identical.
In this scenario, the database names differ between the source and target environments. Because the transport process does not include database connections by design—and each environment uses its own existing connection—a mismatch in database names causes the transported query to fail when the draft model is built.
This results in the following runtime error in the target environment:
A SQL error occurred when building the draft model. The data retrieved from the database may have been corrupted.
This behavior is consistent with the scenario described in SAP Note 3710193.
Resolution
To ensure that transported queries resolve correctly, the database names between the source and target systems must be aligned.
Option 1 — Rename the source database to match the target (Recommended)
Rename the database in the source system so that it matches the database name used in the target system. This allows the transported queries to execute correctly in the target environment.
Important: Renaming the database will affect existing queries in the source system that reference the original database name. These queries must be recreated before they can be transported.
Option 2 — Create a database alias (Alternative)
If renaming the database is not feasible, an alias using the target database name can be created while still pointing to the existing source database (for example, using the CREATE EXTERNAL SCHEMA command in Amazon Redshift).
This approach allows existing queries to continue functioning while ensuring the database name matches the one expected in the target environment.
Note: This approach should be validated within the database environment before being applied in production use.
Additional Recommendation — Submit an Enhancement Request
There is currently no built-in feature to re-point import jobs between different databases. To request this capability for a future release, an Enhancement Request can be submitted through the SAP Influencer platform.
For details on how to submit an idea, see KBA 2424376.
See Also
Keywords
build a query, import job, content transport, transported job fails, sql error, cs_sql_error, does not exist, freehand sql, data acquisition, import connection, internal connection id, draft model, dimension import, model transport, database schema , KBA , LOD-ANA-AQU , Import Data Connections (Acquiring Data) , Problem
SAP Knowledge Base Article - Public