Skip to content

Commit

Permalink
add connect md:
Browse files Browse the repository at this point in the history
  • Loading branch information
drizk1 committed Jul 12, 2024
1 parent 31d8ba5 commit 541fd71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Switches to DuckDB to 1.0 version
- Adds support for `iceberg` tables via DuckDB to read iceberg paths in `db_table` when `iceberg = true`
- Adds support for DuckDB's beta `delta_scan` to read delta paths in `db_table` when `delta = true`
- Adds `connect()` support for DuckDB MotherDuck

## v0.2.3 - 2024-07-07
- Adds direct path support for `db_table` when using DuckDB
Expand Down
8 changes: 7 additions & 1 deletion src/TidierDB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ function connect(backend_type::Symbol, db_type::Symbol; access_key::String="", s
return db
end


function connect(symbol, token::String)
if token == "md:"
return DBInterface.connect(DuckDB.DB, "md:")
else
return DBInterface.connect(DuckDB.DB, "md:$token")
end
end

end
6 changes: 4 additions & 2 deletions src/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,15 @@ This function establishes a database connection based on the specified backend a
# Connect to Snowflake
# conn = connect(:snowflake, "ac_id", "token", "Database_name", "Schema_name", "warehouse_name")
# Connect to DuckDB
julia> db = connect(:duckdb)
# connect to Google Cloud via DuckDB
# google_db = connect(:duckdb, :gbq, access_key="string", secret_key="string")
# Connect to AWS via DuckDB
# aws_db = connect2(:duckdb, :aws, aws_access_key_id=get(ENV, "AWS_ACCESS_KEY_ID", "access_key"), aws_secret_access_key=get(ENV, "AWS_SECRET_ACCESS_KEY", "secret_access key"), aws_region=get(ENV, "AWS_DEFAULT_REGION", "us-east-1"))
# Connect to MotherDuck
# connect(:duckdb, "token") for first connection, vs connect(:duckdb, "md:") for reconnection
julia> db = connect(:duckdb)
DuckDB.Connection(":memory:")
```
"""

const docstring_interpolate =
Expand Down

2 comments on commit 541fd71

@drizk1
Copy link
Member Author

@drizk1 drizk1 commented on 541fd71 Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Switches to DuckDB to 1.0 version
  • Adds support for iceberg tables via DuckDB to read iceberg paths in db_table when iceberg = true
  • Adds support for DuckDB's beta delta_scan to read delta paths in db_table when delta = true
  • DuckDB MotherDucDB: connect(:duckdb, "token") // reconnect connect(:duckdb, "md:")

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/110973

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.4 -m "<description of version>" 541fd713afc77cf3ecc19d3dc366ae5811122400
git push origin v0.2.4

Please sign in to comment.