{"cells":[{"metadata":{},"cell_type":"markdown","source":"# This Notebook shows how to upload your data from GCP JupyterLab to Kaggle Dataset"},{"metadata":{},"cell_type":"markdown","source":"## First, upload *kaggle.json* to root dir"},{"metadata":{},"cell_type":"markdown","source":"### To download *kaggle.json,*\n### go to Your Profile -> Account -> Create New API Token"},{"metadata":{},"cell_type":"markdown","source":"## Then, in your GCP jupyter Notebook"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"## run this code\n## to create a dir ~/.kaggle \n## and copy kaggle.json to this dir\n## and change the mod\n\n!mkdir ~/.kaggle\n!cp kaggle.json ~/.kaggle/kaggle.json\n!chmod 600 ~/.kaggle/kaggle.json","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"## The version 1.5.10 works well\n\n!kaggle --version","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## *FILENAME* is the folder you want to upload to your Kaggle Dataset"},{"metadata":{"trusted":true},"cell_type":"code","source":"!kaggle datasets init -p FILENAME/","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"'''\n{\n  \"title\": \"INSERT_TITLE_HERE\",\n  \"id\": \"YOURUSERNAME/INSERT_TITLE_HERE\",\n  \"licenses\": [\n    {\n      \"name\": \"CC0-1.0\"\n    }\n  ]\n}\n'''\n\n## Running this code will show the info above.\n## go to the folder, open the json file with editor\n## change INSERT_TITLE_HERE with the name you like\n## Cannot leave it default\n## Then CTRL+S\n## After, rerun this code to make sure changes are saved\n\n!cat FILENAME/dataset-metadata.json","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"## I don't know this principle ><\n\n!echo 'hello'>FILENAME/test.txt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"## start upload and make your Kaggle Dataset\n\n!kaggle datasets create -p FILENAME/","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Done!"},{"metadata":{},"cell_type":"markdown","source":"Reference\n\nhttps://www.kaggle.com/c/riiid-test-answer-prediction/discussion/206871\n\nhttps://www.kaggle.com/c/riiid-test-answer-prediction/discussion/208110"}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}