cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unzip Files

Ajay-Pandey
Esteemed Contributor III

Hi all, I am trying to unzip a file in databricks but facing an issue,

Please help me if you have any doc or codes to share.

Ajay Kumar Pandey
1 ACCEPTED SOLUTION

Accepted Solutions

vivek_rawat
New Contributor III

Hey ajay,

You can follow this module to unzip your zip file.

To give your brief idea about this, it will unzip your file directly into your driver node storage.

So If your compressed data is inside DBFS then you first have to move that to drive node and then uncompress that using the following and again move that uncompressed data to DBFS.( dbutils.fs.cp for moving between driver and dbfs)

import subprocess
subprocess.Popen(f'unzip {file_name}.zip', shell=True)

View solution in original post

7 REPLIES 7

Hubert-Dudek
Esteemed Contributor III

Is it community edition or a commercial one?

Ajay-Pandey
Esteemed Contributor III

It's commercial

Ajay Kumar Pandey

Hubert-Dudek
Esteemed Contributor III

bur generally try that library to unzip

import zipfile

Ajay-Pandey
Esteemed Contributor III

Thanks, will try

Ajay Kumar Pandey

vivek_rawat
New Contributor III

Hey ajay,

You can follow this module to unzip your zip file.

To give your brief idea about this, it will unzip your file directly into your driver node storage.

So If your compressed data is inside DBFS then you first have to move that to drive node and then uncompress that using the following and again move that uncompressed data to DBFS.( dbutils.fs.cp for moving between driver and dbfs)

import subprocess
subprocess.Popen(f'unzip {file_name}.zip', shell=True)

Ajay-Pandey
Esteemed Contributor III

Thanks @Vivek Rawat​ it's worked.

Ajay Kumar Pandey

Thank you sir, I will try it.

Thank you sir, I will try it. I discovered a valuable resource look these up by choose the greatest essay writing service, this website offers in-depth reviews of a number of them.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group