Y
Y
yk_vova2020-12-23 19:58:32
Python
yk_vova, 2020-12-23 19:58:32

How to copy .db files from Google Drive?

How can I copy .db files from google drive that are created according to the sqlite3 structure. I write code in Python.

the code

file_db = open('DataBaseUserID.db', 'rb')
file_db.close()
gauth = GoogleAuth()
auth_url = gauth.CommandLineAuth()
drive = GoogleDrive(gauth)
file_list = drive.ListFile({'q': "path_folder in parents and trashed=false"}).GetList()
file_obj = drive.CreateFile({'id': file_list[0]['id']})
file_obj.Trash()
file_obj = drive.CreateFile({'title': 'DataBaseUserID.db', 'mimeType': 'text/txt',
                                     "parents": [
                                         {"kind": "drive#fileLink", "id": path_folder}]})
file_obj.SetContentFile('DataBaseUserID.db')
file_obj.Upload()


ps where path_dolder stands, in my code there is a path to a folder in google drive as text, so don't complain about it

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question