Getting Started
The code below uses the ibis library to connect to the DataArts Fabric data lake, execute data queries, and convert the results into the basic syntax of the DataFrame format.
The example is for reference only. Modify it as needed.
For more detailed usage of Ibis, refer to official Ibis documentation.
import ibis # Import Ibis dependencies. con = ibis.fabric.connect( # Call the DataArts Fabric backend connection to establish a connection. endpoint=FABRIC_ENDPOINT, # Specify the service region. For details, see Regions and Endpoints. endpoint_id=FABRIC_ENDPOINT_ID, # Querying an Endpoint ID domain=FABRIC_DOMAIN, # Tenant name user=FABRIC_USER, # IAM username password=FABRIC_PASS, # IAM password access_key=ACCESS_KEY, # Obtaining an AK/SK secret_key=SECRET_KEY, security_token=SECURITY_TOKEN, # Obtaining a Temporary AK/SK project_id=FABRIC_PROJECT_ID, # How Do I Obtain a Project ID? catalog_name=IBIS_TEST_FABRIC_CATELOG, # Connect to a specified catalog. workspace_id=FABRIC_WORKSPACE_ID, # Obtaining a Workspace ID lakeformation_instance_id=IBIS_TEST_FABRIC_LAKEFORMATION_INSTANCE_ID, # LakeFormation instance ID. For details, see Mapping Between DataArts Fabric SQL and LakeFormation Data Types. obs_directory_base=OBS_DIRECTORY_BASE, # Storage path for UDFs in OBS. obs_bucket_name=OBS_BUCKET_NAME, # OBS bucket name. obs_server=OBS_SERVER, # OBS access address. For details, see Endpoints and Domain Names. verify=VERIFY, # Whether to verify the server's SSL certificate. The value is of the Boolean type. ) t = con.table("table_name", database="db") # Retrieve table information by connecting to the backend and create a table object. t.select("cola") # Query table columns. df = t.execute() # Convert DataFrame to SQL, send it to the backend for execution, and return the result in Pandas DataFrame format.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot