This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.sql.*; | |
| import java.util.Properties; | |
| public class Query { | |
| // Note that the 'username/db_name' must use a '.' instead of a '/' for JDBC | |
| private static final String url = | |
| "jdbc:postgresql://db.bit.io/dliden.2020_Census_Reapportionment"; | |
| public static void main(String[] args) { | |
| Properties props = new Properties(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import io | |
| import json | |
| data = {"a": 1, "b": "world"} | |
| buffer = io.StringIO() | |
| json.dump(data, buffer) | |
| buffer.seek(0) | |
| url = 'https://import.bit.io/doss/json_upload/example' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bitdotio | |
| # Connect to bit.io | |
| b = bitdotio.bitdotio(<YOUR_BITIO_KEY>) | |
| # Download demo csv here: | |
| # https://raw.githubusercontent.com/bitdotioinc/connection_snippets/main/video-game-sales.csv | |
| # Upload to 'my_new_repo' with table name 'video_game_sales_csv' | |
| with open('video-game-sales.csv', 'r', encoding='utf-8') as f: | |
| b.create_import_file(f, 'my_new_repo', 'video_game_sales_csv') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| with open("$PATH_TO_FILE", 'rb') as f: | |
| data = f.read() | |
| url = 'https://import.bit.io/$USERNAME/$REPO_NAME/$TABLE_NAME' | |
| headers = { | |
| "Content-Disposition": "attachment;filename='test.csv'", | |
| "Authorization": "Bearer $TOKEN" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package database | |
| import ( | |
| "testing" | |
| ) | |
| func BenchmarkConnWithName(b *testing.B) { | |
| for i := 0; i < b.N; i++ { | |
| ConnWithName() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package database | |
| import ( | |
| "context" | |
| "fmt" | |
| "os" | |
| "github.com/jackc/pgx/v4" | |
| "github.com/jackc/pgx/v4/pgxpool" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Main Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| extract-transform-load: | |
| runs-on: ubuntu-latest | |
| env: | |
| PG_CONN_STRING: ${{ secrets.PG_CONN_STRING }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request Test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| extract-transform-load: | |
| runs-on: ubuntu-latest | |
| env: | |
| PG_CONN_STRING: ${{ secrets.PG_CONN_STRING }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * | |
| FROM "doss/demo_repo"."json_demo" | |
| WHERE (json_object_data) ->> 'Name' = 'Wii Sports' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| {"id": 1, | |
| "json_object_data": { | |
| "Rank": 1, | |
| "Name": "Wii Sports", | |
| "Platform": "Wii", | |
| "Year": 2006, | |
| "Genre": "Sports", | |
| "Publisher": "Nintendo", | |
| "NA_Sales": 41.49, |
NewerOlder