{"id":26260340,"url":"https://github.com/mashiike/redshift-data-sql-driver","last_synced_at":"2025-04-30T07:05:10.726Z","repository":{"id":63330140,"uuid":"564609854","full_name":"mashiike/redshift-data-sql-driver","owner":"mashiike","description":"go sql driver for Redshift-Data API","archived":false,"fork":false,"pushed_at":"2024-03-28T13:31:10.000Z","size":65,"stargazers_count":8,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T07:05:01.076Z","etag":null,"topics":["go","redshift","sql-driver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mashiike.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-11T04:34:22.000Z","updated_at":"2024-05-09T06:36:59.000Z","dependencies_parsed_at":"2024-06-19T22:46:29.404Z","dependency_job_id":"0c99abbb-0f4b-4760-897c-45495b1a68a9","html_url":"https://github.com/mashiike/redshift-data-sql-driver","commit_stats":{"total_commits":27,"total_committers":3,"mean_commits":9.0,"dds":"0.40740740740740744","last_synced_commit":"9fc1833cd4cbf9271301bd43109ec23702fe14a4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashiike%2Fredshift-data-sql-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashiike%2Fredshift-data-sql-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashiike%2Fredshift-data-sql-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashiike%2Fredshift-data-sql-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mashiike","download_url":"https://codeload.github.com/mashiike/redshift-data-sql-driver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658200,"owners_count":21622819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","redshift","sql-driver"],"created_at":"2025-03-13T23:14:39.547Z","updated_at":"2025-04-30T07:05:10.700Z","avatar_url":"https://github.com/mashiike.png","language":"Go","readme":"# redshift-data-sql-driver\n\n[![Documentation](https://godoc.org/github.com/mashiike/redshift-data-sql-driver?status.svg)](https://godoc.org/github.com/mashiike/redshift-data-sql-driver)\n![Latest GitHub tag](https://img.shields.io/github/tag/mashiike/redshift-data-sql-driver.svg)\n![Github Actions test](https://github.com/mashiike/redshift-data-sql-driver/workflows/Test/badge.svg?branch=main)\n[![Go Report Card](https://goreportcard.com/badge/mashiike/redshift-data-sql-driver)](https://goreportcard.com/report/mashiike/redshift-data-sql-driver)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mashiike/redshift-data-sql-driver/blob/master/LICENSE)\n\nRedshift-Data API SQL Driver for Go's [database/sql](https://pkg.go.dev/database/sql) package\n\n## Usage \n\nfor example:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"database/sql\"\n    \"log\"\n\n    _ \"github.com/mashiike/redshift-data-sql-driver\"\n)\n\nfunc main() {\n    db, err := sql.Open(\"redshift-data\", \"workgroup(default)/dev?timeout=1m\")\n    if err != nil {\n        log.Fatalln(err)\n    }\n    defer db.Close()\n    rows, err := db.QueryContext(\n        context.Background(),\n        `SELECT table_schema,table_name,table_type FROM svv_tables WHERE table_schema not like :ignore_schema`,\n        sql.Named(\"ignore_schema\", \"pg_%\"),\n    )\n    if err != nil {\n        log.Fatalln(err)\n    }\n    for rows.Next() {\n        var schema, name, tableType string\n        err := rows.Scan(\u0026schema, \u0026name, \u0026tableType)\n        if err != nil {\n            log.Println(err)\n            return\n        }\n        log.Printf(\"%s.%s\\t%s\", schema, name, tableType)\n    }\n}\n```\n\nThe pattern for specifying DSNs is as follows\n\n- with redshift serverless: `workgroup([name])/[database]`\n- with provisoned cluster: `[dbuser]@cluster([name])/[database]`\n- with AWS Secrets Manager: `arn:aws:secretsmanager:us-east-1:0123456789012:secret:redshift`\n\nThe DSN parameters include\n\n- `timeout`: Timeout for query execution. default = `15m0s`\n- `polling`: Interval to check for the end of a running query. default = `10ms`\n- `region`: Redshift Data API's region. Default is environment setting\n\nParameter settings are in the format of URL query parameter\n\n`workgroup(default)/dev?timeout=1m\u0026polling=1ms`\n\n### Transaction Notes\n\nThe Redshift Data API does not have an interface for pasting transactions and querying sequentially.\nTherefore, we have implemented an unusual implementation.\n\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"database/sql\"\n    \"log\"\n\n    _ \"github.com/mashiike/redshift-data-sql-driver\"\n)\n\nfunc main() {\n    db, err := sql.Open(\"redshift-data\", \"workgroup(default)/dev?timeout=1m\")\n    if err != nil {\n        log.Fatalln(err)\n    }\n    defer db.Close()\n    tx, err := db.BeginTx(context.Background(), nil)\n    if err != nil {\n        log.Fatalln(err)\n    }\n    tx.ExecContext(context.Background(), \"INSERT INTO foo VALUES (1)\")\n    tx.ExecContext(context.Background(), \"INSERT INTO foo VALUES (2)\")\n    tx.ExecContext(context.Background(), \"INSERT INTO foo VALUES (3)\")\n    tx.Commit() // BatchExecuteStatement API is called here, and the queries called during the transaction are executed together\n}\n```\n\nAlso, because the interface does not match, `Query` and `QueryContext` in the transaction are not supported.\n`Exec` and `ExecContext` in the transaction are not supported.\n\n## Unsupported Features\n\nThe following functions are not available\n\n### [Prepare](https://pkg.go.dev/database/sql#DB.Prepare)\n\nPrepared Statements were not supported because the Redshift Data API does not have the concept of connecting to a DB.\n\n## LICENSE\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashiike%2Fredshift-data-sql-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmashiike%2Fredshift-data-sql-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashiike%2Fredshift-data-sql-driver/lists"}