snowflake-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Snowfake-ts

Usage:


@Table("people")
class Person {

    @Column("id")
    id?: number

    @Column("name")
    name?: string

    @Column("dob")
    dob?: Date
}


const client = await SnowflakeClient.createConnection({
        username: process.env["SNOWFLAKE_USERNAME"] as string,
        password: process.env["SNOWFLAKE_PASSWORD"] as string,
        account: process.env["SNOWFLAKE_ACCOUNT"] as string,
        database: "test",
        schema: "raw"
    })

    await client.execute(`
CREATE TABLE IF NOT EXISTS
people(id INT, name STRING, dob TIMESTAMP)`)

    const toInsert = [...Array(20).keys()]
        .map(i => ({
            id: i,
            name: `Fred ${i}`,
            dob: new Date(2000, 1, i)
        }))


    await Stream
        .from(toInsert)
        .sink(client.sink(Person, 50))
        .then(_ => client.readStreamOf(Person))
        .then(peepsInDb => peepsInDb.toArray())
        .then(peeps => expect(peeps).toIncludeAllMembers(toInsert))
        .then(_ => client.execute("delete from people"))

})

Readme

Keywords

none

Package Sidebar

Install

npm i snowflake-ts

Weekly Downloads

7

Version

1.0.7

License

MIT

Unpacked Size

264 kB

Total Files

49

Last publish

Collaborators

  • mtranter