-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Oracle run_result.json has rows_affected = 0 always when data are inserted or updated into target table #134
Comments
Which python driver are you using ? is it
Please switch to the new driver if you have not done. To switch to the thin driver, you can set the following environment variable before running dbt
This should populate |
Thanks, @aosingh , Let me check and get back to you |
Hi @aosingh
This is our command
|
Thank you @cindyzh-ibm. What is the version of python3 -c "import oracledb; print(oracledb.__version__)" Also, please share the output of command dbt --version
I have been trying to reproduce the problem with I tried a few simple cases which seem to work fine.
"results": [
{
"status": "success",
"timing": [
{
"name": "compile",
"started_at": "2024-02-23T01:26:39.822399Z",
"completed_at": "2024-02-23T01:26:39.822408Z"
},
{
"name": "execute",
"started_at": "2024-02-23T01:26:39.824222Z",
"completed_at": "2024-02-23T01:26:40.628122Z"
}
],
"thread_id": "Thread-1",
"execution_time": 0.8198621273040771,
"adapter_response": {
"_message": "INSERT 5",
"code": "INSERT",
"rows_affected": 5
},
"message": "INSERT 5",
"failures": null,
"unique_id": "seed.dbt_adbs_test_project.seed"
}
],
"results": [
{
"status": "success",
"timing": [
{
"name": "compile",
"started_at": "2024-02-23T01:28:30.549139Z",
"completed_at": "2024-02-23T01:28:30.555564Z"
},
{
"name": "execute",
"started_at": "2024-02-23T01:28:30.556883Z",
"completed_at": "2024-02-23T01:28:31.258269Z"
}
],
"thread_id": "Thread-1",
"execution_time": 0.730828046798706,
"adapter_response": {
"_message": "OK",
"rows_affected": 5
},
"message": "OK",
"failures": null,
"unique_id": "model.dbt_adbs_test_project.people"
}
], |
|
For your question of "Are you using incremental models ?". No
|
@cindyzh-ibm is Could you verify "target" relation is returned in the end ? -- Return the relations created in this materialization
{{ return({'relations': [target_relation]}) }} |
@aosingh Yes, we use custom materialization. No, we don't have "target" relation is returned in the end.
|
@cindyzh-ibm |
@aosingh custom materialization prepares and submits sql statements |
I understand these are SQL statements. What is the last statement executed in your custom materialization? dbt-oracle uses The documentation states that Immediately after the cursor.execute() call has been made, if no rows have been fetched, the result will be 0. If you call cursor.fetchone() then result will be 1 and if you call cursor.fetchmany(5) then the result will be 6, and so forth Did you try returning the target relation in the end ? -- Return the relations created in this materialization
{{ return({'relations': [target_relation]}) }} |
@aosingh ok.
Update statement
I haven't tried following yet. So far we don't have "target" relation is returned in the end.
|
Thanks, you are executing a PL/SQL( The value for |
Is there an existing issue for this?
Current Behavior
run_results.json has rows_affected = 0 always even when there are data are inserted into target table or updated in the target table.
Expected Behavior
Expected run_results.json have
Steps To Reproduce
Create a flow with Oracle as source and target,
Run the flow to get the run_results.json
Relevant log output using
--debug
flag enabledNo response
Environment
What Oracle database version are you using dbt with?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: