Snowflake

A data warehouse built for the cloud

Integrate the Snowflake API with the Google Drive API

Setup the Snowflake API trigger to run a workflow which integrates with the Google Drive API. Pipedream's integration platform allows you to integrate Snowflake and Google Drive remarkably fast. Free for developers.

Add File Sharing Preference with Google Drive API on New Row from Snowflake API
Snowflake + Google Drive
 
Try it
Add File Sharing Preference with Google Drive API on Query Results from Snowflake API
Snowflake + Google Drive
 
Try it
Copy File with Google Drive API on New Row from Snowflake API
Snowflake + Google Drive
 
Try it
Copy File with Google Drive API on Query Results from Snowflake API
Snowflake + Google Drive
 
Try it
Create a New File with Google Drive API on New Row from Snowflake API
Snowflake + Google Drive
 
Try it
New Query Results from the Snowflake API

Emit new event with the results of an arbitrary query

 
Try it
Changes to Specific Files from the Google Drive API

Watches for changes to specific files, emitting an event any time a change is made to one of those files. To watch for changes to shared drive files, use the Changes to Specific Files (Shared Drive) source instead.

 
Try it
New Row from the Snowflake API

Emit new event when a row is added to a table

 
Try it
Changes to Specific Files (Shared Drive) from the Google Drive API

Watches for changes to specific files in a shared drive, emitting an event any time a change is made to one of those files

 
Try it
New Files (Instant) from the Google Drive API

Emit new event any time a new file is added in your linked Google Drive

 
Try it
Insert Row with the Snowflake API

Insert a row into a table

 
Try it
Add File Sharing Preference with the Google Drive API

Add a sharing permission to the sharing preferences of a file and provide a sharing URL. See the docs for more information

 
Try it
Copy File with the Google Drive API

Create a copy of the specified file. See the docs for more information

 
Try it
Create a New File with the Google Drive API

Create a new file from a URL or /tmp/filepath. See the docs for more information

 
Try it
Create Folder with the Google Drive API

Create a new empty folder. See the docs for more information

 
Try it

Connect Snowflake

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module.exports = defineComponent({
  props: {
    snowflake: {
      type: "app",
      app: "snowflake",
    }
  },
  async run({steps, $}) {
    // Example query
    const sqlText = `SELECT CURRENT_TIMESTAMP();`
    
    const { promisify } = require('util')
    const snowflake = require('snowflake-sdk')
    
    const connection = snowflake.createConnection(this.snowflake.$auth)
    
    const connectAsync = promisify(connection.connect)
    
    try {
      await connectAsync()
    } catch (err) {
      console.error('Unable to connect: ' + err.message)
    }
    
    // util.promisify requires the last argument of the function you pass to 
    // it be the callback function, according to Node convention — see the docs at
    // https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original .
    // Since Snowflake's connection.execute function accepts a single argument — 
    // options, an object — using promisify won't work. So we wrap the callback 
    // with a Promise and await it below.
    //
    // Pass the same options object (e.g. sqlText, binds), _except_ for the callback
    // parameter. Instead, you'll want to await the result, which contains the 
    // stmt and rows object the callback version of the function passes, using 
    // a catch block to catch any errors, e.g.
    //
    //   try {
    //     const { stmt, rows } = await connExecuteAsync({
    //       sqlText: `insert into your_table select parse_json('{"foo": "bar"}')`,
    //     })
    //   } catch (err) {
    //     console.error(`Failed to execute statement due to the following error: ${err.message}`)
    //   }
    //
    async function connExecuteAsync(options) {
      return new Promise((resolve, reject) => {
        const statement = connection.execute({
          ...options,
          complete: function(err, stmt, rows) {
            if (err) {
              reject(err)
            } else {
              resolve({stmt, rows})
            }
          }
        })
      })
    }
    
    try {
      const { stmt, rows } = await connExecuteAsync({
        sqlText,
        fetchAsString: ['Number', 'Date'],
      })
      console.log(JSON.stringify(rows, null, 2))
    } catch (err) {
      console.error(`Failed to execute statement due to the following error: ${err.message}`)
    }
  },
})

Connect Google Drive

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    google_drive: {
      type: "app",
      app: "google_drive",
    }
  },
  async run({steps, $}) {
    return await axios($, {
      url: `https://www.googleapis.com/oauth2/v1/userinfo`,
      headers: {
        Authorization: `Bearer ${this.google_drive.$auth.oauth_access_token}`,
      },
    })
  },
})