Table Files
Description
No description available
Supported Operations
Below section contains supported CRUD operations. Each operation is executed by some EndPoint behind the scene.| Method | Supported | Reference EndPoint |
|---|---|---|
| SELECT | list_files | |
| INSERT | upload_file | |
| UPDATE | update_file | |
| UPSERT | ||
| DELETE | delete_item | |
| LOOKUP | get_file_info |
Examples
SSIS
Use Google Drive Connector in API Source component to read data or in API Destination component to read/write data:
Read from Files table using API Source
| Optional Parameters | |
|---|---|
| Search Criteria | mimeType!='application/vnd.google-apps.folder' AND trashed!=true |
Read/write to Files table using API Destination
| Optional Parameters | |
|---|---|
| Search Criteria | mimeType!='application/vnd.google-apps.folder' AND trashed!=true |
ODBC application
Use these SQL queries in your ODBC application data source:
List / search files from my drive
<p>Lists or searches files in the user's My Drive. Use the <code>Query</code> parameter to filter by name or other criteria (e.g. <code>name contains "ZappySys*.*"</code>).</p>
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"',
)
List / search files from a single shared drive
<p>Lists or searches files in one shared drive. Supply <code>DriveId</code> and set <code>DriveType='drive'</code>, <code>SupportsAllDrives='true'</code>, and <code>IncludeItemsFromAllDrives='true'</code>. Optionally use <code>Query</code> to filter.</p>
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"',
DriveId='0AFWIggplk2z6Uk9PVA',
DriveType='drive',
SupportsAllDrives='true',
IncludeItemsFromAllDrives='true'
)
List / search files from all shared drives
<p>Lists or searches files across all shared drives the user can access. Set <code>DriveType='allDrives'</code> with <code>SupportsAllDrives</code> and <code>IncludeItemsFromAllDrives</code>. Optionally use <code>Query</code> to filter.</p>
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"',
DriveType='allDrives',
SupportsAllDrives='true',
IncludeItemsFromAllDrives='true'
)
List files
<p>Returns the list of files in the user's drive (or filtered by WITH options).</p>
SELECT * FROM Files
Update a file
<p>Updates an existing file by uploading new content from a local path. Supply the file ID and the path to the new file (<code>DiskFilePath</code>).</p>
UPDATE Files
WITH(Id='1EVzXFVBQIh3LcJvfcLhI1UWhW3qUxFkM',
DiskFilePath='C:\MyFiles\myfile.ext')
Delete a file
<p>Deletes a file by ID. Supply the file ID in the WITH clause.</p>
DELETE FROM Files
WITH(Id='1gcu0hV34OTfgvcu9CFhr7Go4b35j5Mop')
Delete a file by name from a shared drive
<p>Deletes a file by name from a shared drive. Supply the file name in the WHERE clause and the shared drive ID in WITH. Use <code>Trashed=0</code> to target only non-trashed files.</p>
DELETE FROM Files
WHERE Name='dump.csv' AND Trashed=0
WITH(DriveId='0AC00HWQH144cUk9PVA', DriveType='drive')
Upload a file with INSERT
<p>Uploads a file using <code>INSERT INTO Files</code>. Supply file name, source path (<code>DiskFilePath</code>), and parent folder ID. This form allows bulk uploads via the SOURCE clause.</p>
INSERT INTO Files
WITH(FileName='My filename',
DiskFilePath='C:\MyFolder\Mymyfile.ext',
ParentFolderId='root')
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
List / search files from my drive
<p>Lists or searches files in the user's My Drive. Use the <code>Query</code> parameter to filter by name or other criteria (e.g. <code>name contains "ZappySys*.*"</code>).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM Files
WITH(
--Query=''name contains "ZappySys*.*"'',
)';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
List / search files from a single shared drive
<p>Lists or searches files in one shared drive. Supply <code>DriveId</code> and set <code>DriveType='drive'</code>, <code>SupportsAllDrives='true'</code>, and <code>IncludeItemsFromAllDrives='true'</code>. Optionally use <code>Query</code> to filter.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM Files
WITH(
--Query=''name contains "ZappySys*.*"'',
DriveId=''0AFWIggplk2z6Uk9PVA'',
DriveType=''drive'',
SupportsAllDrives=''true'',
IncludeItemsFromAllDrives=''true''
)';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
List / search files from all shared drives
<p>Lists or searches files across all shared drives the user can access. Set <code>DriveType='allDrives'</code> with <code>SupportsAllDrives</code> and <code>IncludeItemsFromAllDrives</code>. Optionally use <code>Query</code> to filter.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM Files
WITH(
--Query=''name contains "ZappySys*.*"'',
DriveType=''allDrives'',
SupportsAllDrives=''true'',
IncludeItemsFromAllDrives=''true''
)';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
List files
<p>Returns the list of files in the user's drive (or filtered by WITH options).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM Files';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
Update a file
<p>Updates an existing file by uploading new content from a local path. Supply the file ID and the path to the new file (<code>DiskFilePath</code>).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'UPDATE Files
WITH(Id=''1EVzXFVBQIh3LcJvfcLhI1UWhW3qUxFkM'',
DiskFilePath=''C:\MyFiles\myfile.ext'')';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
Delete a file
<p>Deletes a file by ID. Supply the file ID in the WITH clause.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'DELETE FROM Files
WITH(Id=''1gcu0hV34OTfgvcu9CFhr7Go4b35j5Mop'')';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
Delete a file by name from a shared drive
<p>Deletes a file by name from a shared drive. Supply the file name in the WHERE clause and the shared drive ID in WITH. Use <code>Trashed=0</code> to target only non-trashed files.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'DELETE FROM Files
WHERE Name=''dump.csv'' AND Trashed=0
WITH(DriveId=''0AC00HWQH144cUk9PVA'', DriveType=''drive'')';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
Upload a file with INSERT
<p>Uploads a file using <code>INSERT INTO Files</code>. Supply file name, source path (<code>DiskFilePath</code>), and parent folder ID. This form allows bulk uploads via the SOURCE clause.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO Files
WITH(FileName=''My filename'',
DiskFilePath=''C:\MyFolder\Mymyfile.ext'',
ParentFolderId=''root'')';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];