Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
Shrujan1612
Helper I
Helper I

Issue while running python query in Fabric Notebook

While i was run the above query in the Fabric Notebooks, it is throwing me below error, can any one help me with the issue.
 
Query: 
 
from fabric import connection
import cx_Oracle
import pandas as pd
import matplotlib.pyplot as plt

 

# Oracle DB connection details
username = "xxx"
password = "xxx"
hostname = "ebs122.xxx.com"
port = "xxx"
service = "xxx"

 

# Create a connection
connection = cx_Oracle.connect(username, password, hostname + ":" + port + "/" + service)



# SQL Query
query = """
SELECT
  TO_CHAR(CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID) AS BU_ID ,
  TO_CHAR(CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID)  AS BU_NUM,
  CALL_ORGANIZATION_UNITS_TL_1.NAME  AS BU_NAME,
  CORGANIZATION_INFORMATION_1.ORG_INFORMATION_ID  AS ORG_INFORMATION_ID,
  TO_CHAR(GL_LEDGERS.NAME)  AS LEDGER_NAME,
  TO_CHAR(CALL_ORGANIZATION_UNITS_1.DATE_FROM,'DD-MON-YYYY')  AS EFFECTIVE_START_DT,
  TO_CHAR(CALL_ORGANIZATION_UNITS_1.DATE_TO,'DD-MON-YYYY')  AS EFFECTIVE_END_DT,
  CALL_ORGANIZATION_UNITS_TL_1.LANGUAGE  AS LANGUAGE,
  CALL_ORGANIZATION_UNITS_1.ATTRIBUTE1  AS ATTRIBUTE1,
  CALL_ORGANIZATION_UNITS_1.ATTRIBUTE2  AS ATTRIBUTE2,
  CALL_ORGANIZATION_UNITS_1.ATTRIBUTE3  AS ATTRIBUTE3,
  CALL_ORGANIZATION_UNITS_1.ATTRIBUTE4  AS ATTRIBUTE4,
  CALL_ORGANIZATION_UNITS_1.ATTRIBUTE5  AS ATTRIBUTE5,
  CALL_ORGANIZATION_UNITS_1.CREATION_DATE  AS CREATION_DT,
  CALL_ORGANIZATION_UNITS_1.LAST_UPDATE_DATE  AS LAST_UPDATE_DT,
  CALL_ORGANIZATION_UNITS_1.CREATED_BY  AS CREATED_BY,
  CALL_ORGANIZATION_UNITS_1.LAST_UPDATED_BY AS LAST_UPDATED_BY,
  to_CHAR(CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID)  AS INTEGRATION_ID,
  1000  AS DATASOURCE_NUM_ID,
  NULL AS ACTIVE_FLAG,
  NULL AS DELETE_FLAG
FROM
   APPS.HR_ALL_ORGANIZATION_UNITS CALL_ORGANIZATION_UNITS_1 ,  APPS.HR_ORGANIZATION_INFORMATION CORGANIZATION_INFORMATION_1      ,  APPS.HR_ALL_ORGANIZATION_UNITS_TL CALL_ORGANIZATION_UNITS_TL_1      ,  APPS.GL_LEDGERS GL_LEDGERS      
WHERE
  (1=1
AND CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID = CORGANIZATION_INFORMATION_1.ORGANIZATION_ID
  AND ( 'Operating Unit Information' ) = CORGANIZATION_INFORMATION_1.ORG_INFORMATION_CONTEXT
 AND CORGANIZATION_INFORMATION_1.ORG_INFORMATION3 = TO_CHAR(GL_LEDGERS.LEDGER_ID(+))
  AND CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID = CALL_ORGANIZATION_UNITS_TL_1.ORGANIZATION_ID
    AND ( USERENV('LANG') ) = CALL_ORGANIZATION_UNITS_TL_1.LANGUAGE AND
   ( SYSDATE BETWEEN CALL_ORGANIZATION_UNITS_1.DATE_FROM AND
  NVL(CALL_ORGANIZATION_UNITS_1.DATE_TO,SYSDATE) ) AND ROWNUM <= 100
)  
"""
# Execute SQL query
'''cursor = connection.cursor()
cursor.execute(query)'''

 

# Execute the query and fetch the results into a pandas DataFrame
df = pd.read_sql(query, connection)

 

# Close the connection
connection.close()

 

#Selected columns
selected_columns = ['BU_ID', 'BU_NAME', 'LEDGER_NAME', 'EFFECTIVE_START_DT', 'EFFECTIVE_END_DT']

 

#selected required columns from df
selected_df = df[selected_columns]

 

# Display the DataFrame as a table
print(selected_df)

--Error:
DatabaseError Traceback (most recent call last) Cell In[7], line 14 11 service = "VIS" 13 # Create a connection ---> 14 connection = cx_Oracle.connect(username, password, hostname + ":" + port + "/" + service) 16 # SQL Query 17 query = """ 18 SELECT 19 TO_CHAR(CALL_ORGANIZATION_UNITS_1.ORGANIZATION_ID) AS BU_ID , (...) 51 ) 52 """ DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
 
I have uploaded jar file also into Builtin 
Shrujan1612_0-1715259633518.png

but it dosen't make any difference

5 REPLIES 5
ShrujanKuma1612
Regular Visitor

Downloaded and succesfully loaded animation-1.2.0.jar but still facing same issue.

ShrujanKuma1612_0-1715668002396.png

ShrujanKuma1612_1-1715668062414.png

 

 

Anonymous
Not applicable

Hi @Shrujan1612 , @ShrujanKuma1612 

Apologize for the issue you are facing. The best course of action is to open a support ticket and have our support team take a closer look at it.

 

Please reach out to our support team so they can do a more thorough investigation on why this it is happening: Link 

 

After creating a Support ticket please provide the ticket number as it would help us to track for more information.

 

Hope this helps. Please let us know if you have any other queries.

Anonymous
Not applicable

Hi @ShrujanKuma1612 , @Shrujan1612 ,

We haven’t heard from you on the last response and was just checking back to see if you got a chance to create a support ticket.
After creating a Support ticket please provide the ticket number as it would help us to track for more information.

Thanks

Anonymous
Not applicable

Hi @Shrujan1612 ,

Thanks for using Fabric Community.

Please try to load the jar via the following magic: 

# Load jar directly to the Scala interpreter

%load_new_custom_jar {mssparkutils.nbResPath}/builtin/Animation1.jar

 

Starting a new SparkSession doesn't work here. You can also drag and drop a jar file from notebook filesystem. Here's the doc: How to use notebooks - Microsoft Fabric | Microsoft Learn

Hope this helps.

Anonymous
Not applicable

Hello @Shrujan1612 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
Otherwise, will respond back with the more details and we will try to help .
Thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.