shahar1 commented on PR #29477:
URL: https://github.com/apache/airflow/pull/29477#issuecomment-1434910462
> This comment is in regards to this issue: #29552
>
> @shahar1 I pulled your code and only added `folder_id` assignments
>
> ```
> file_upload = LocalFilesystemToGoogleDriveOperator(
> task_id="uploading-file"
> gcp_conn_id="gc-conn-id",
> drive_folder="Folder A",
> folder_id="Folder_A_ID",
> local_paths=[f"/tmp/file_to_upload.csv"]
> )
> ```
>
> The good news is that file was uploaded to a shared drive, however path's
are not matching what I meant. I wanted the file to be uploaded to `/Folder
A/file.csv`, but it resulted in `/Folder_A_ID/Folder A/file.csv`
>
> That was the case when name of the `folder_id` was equal to
`drive_folder`. But maybe I expected that because I knew what the behaviour was
previously.
>
> In order to get what I wanted I had to run this:
>
> ```
> file_upload = LocalFilesystemToGoogleDriveOperator(
> task_id="uploading-file"
> gcp_conn_id="gc-conn-id",
> drive_folder="/",
> folder_id="Folder_A_ID",
> local_paths=[f"/tmp/file_to_upload.csv"]
> )
> ```
>
> so it solves the problem, but then logs message is quite misleading.
>
> ```
> [2023-02-15, 11:25:52 UTC] {drive.py:238} INFO - File
/tmp/file_to_upload.csv uploaded to gdrive:///file_to_upload.csv.
> ```
>
> Would be nice to get `folder_id` real path. - Not sure if possible
>
> In case this goes forward the documentation would have to be improved &
maybe rename `folder_id` to `parent_folder_id` in this case and `drive_folder`
to `path`. But if someone doesn't fill `folder_id` then it gets cumbersome.
>
> When I run:
>
> ```
> file_upload = LocalFilesystemToGoogleDriveOperator(
> task_id="uploading-file"
> gcp_conn_id="gc-conn-id",
> drive_folder="Folder A",
> folder_id="root", #I could skip that param, but added to be clear.
> local_paths=[f"/tmp/test-file-csv.csv"]
> )
> ```
>
> then it's placed on the user's own drive under `Folder A` - it's a correct
behaviour
>
> @eladkal But yeah! Overall it's almost there!
Hey, thanks for the suggestion - I just added the `folder_id` as a parameter
of the operator with a default `root` value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]