how can I copy data from isilon On-Prem fileshare from azure databricks. I need example code - databricks notebook

Madan Singh, Lakshmi 0 Reputation points
2024-02-29T15:54:55.0733333+00:00

We need a way to copy data from Isilon fileshare (On - Prem) to ADLS using azure databricks. Can we achieve this using any pypy library. a sample code will help.

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,514 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Madan Singh, Lakshmi 0 Reputation points
    2024-03-11T09:52:55.0166667+00:00

    We establish the connection using smbprotocol library in Python and Domain join to provide permission on fileshare.

    from smb.SMBConnection import SMBConnection
    from smb.smb2_constants import SMB2_DIALECT_2
    
    
    server_name = 'fileshare_host_name'
    domain = 'your_domain'
    share_name = 'your_share_name' #(example: \\xyz02.abc.com\env\Test, share name here is Test)
    username = 'your.username'
    password = 'your_password'
    
    # Create an SMBConnection object with SMBv2
    conn = SMBConnection(username, password, 'client', server_name, domain, use_ntlm_v2=True, is_direct_tcp=True)
    
    # Connect to the SMB share
    conn.connect(server_name, 445)
    
    # List files in the share
    file_list = conn.listPath(share_name, '')
    print(file_list)
    
    # Iterate through the file list and print the filenames
    for file in file_list:
        if file.filename not in ('.', '..'):
            print(file.filename)
    
    conn.close()
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.