simonw / google-drive-to-sqlite

Create a SQLite database containing metadata from Google Drive
https://datasette.io/tools/google-drive-to-sqlite
Apache License 2.0
152 stars 13 forks source link

`files --id` multiple option for fetching specific files #27

Open simonw opened 2 years ago

simonw commented 2 years ago

I want to be able to fetch only specific files that I list into the database.

simonw commented 2 years ago

Not clear if I can construct a ?q= query that gets everything where the ID is x or y or z - or if I need to make a separate API call for each provided file ID.

https://developers.google.com/drive/api/v3/ref-search-terms

simonw commented 2 years ago

id = '10BOHGDUYa7lBjUSo26YFCHTpgEmtXabdVFaopCTh1vU' does not work as a valid q= expression.

1kaiser commented 2 years ago

how to sort by "untrashed" files in--nlview !google-drive-to-sqlite files --folder xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --nl -q '"trashed": false' <<<<<???

1kaiser commented 2 years ago

βœ…βœ…βœ…πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»πŸ₯³πŸ₯³πŸ₯³πŸ₯³πŸ₯³πŸ₯³πŸ₯³

import json file=[] file=!google-drive-to-sqlite files --folder 1ph2v7i3Qm8U6KVPh1DEJ1UCXRKVMYEY0 --nl #print(type(file)) print(len(file)) count=0 k=1 #k = 1 is taken as <class 'IPython.utils.text.SList'> variable file first row is the describtion of the folder itself while k!=len(file): b = json.loads(file[k]) #converts <class 'IPython.utils.text.SList'> first row to dictionary #print(b) #print(type(file[0])) #print(b["trashed"]) if(b["trashed"]==0): #checking if the file is trashed or not i.e. (trashed = 1 , untrashed = 0) count+=1 #difined above so that it can count the number of undeleted files as remaining would be equals to the available files `` k+=1 print(count) #now we can use the count value confidently to keep track of files uploaded and available so that we can start processing the next file i.e.

successfully working as expected πŸ‘πŸ»πŸ™πŸ»thank you very much here implemented >>> [https://github.com/1kaiser/blender-colab/blob/master/BlenderColab.ipynb]

Screenshot 2022-02-27 003233

i was using [gshell](https://github.com/wkentaro/gshell) by @wkentaro previously but the command !gshell --id xxxxxxxxxxxxxxxxxxxxxxxxx ls lists only 100 datas from the folder-id , hence switched to implement yours SQL folder access its kind of NUMA to quickly get the folder+file structure yet gshell is useful for uploading/downloading large files...thats what i learnt ! πŸ™‚πŸ˜Ž