shipyard-motherduck
Installation
python3 -m pip install shipyard-motherduck
Usage
In order to initalize the client, pass the access token to the MotherDuckClient object:
client = MotherDuckClient("<access_token>")
Additionally you can connect to a specifc database by supplying the database to the client:
client = MotherDuckClient("<access_token>", database = 'my_db')
Loading Data
The upload method allows for a quick upload of a file to a table in MotherDuck. If the table does not exist,
it will be created. The target table can also be appended to by setting the insert_method to 'append'.
Example:
client.upload(table_name = 'my_new_table', file_path = 'my_data.csv', insert_method = 'replace')
Fetching Data
The fetch method returns the results of a SQL query as a DuckDBPyRelation type. From there, it can be converted to a DataFrame or
written to a file.
Example:
results = client.fetch('select * from my_new_table')
df = results.to_df()
Executing a Query
The execute_query method executes a SQL query in MotherDuck. The difference between this and the fetch method is that this
does not return results and is intended for ALTER, CREATE, DROP and other DDL queries.
Example:
client.execute_query('DROP TABLE my_new_table')
Metadata
Release files for shipyard-motherduck 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shipyard_motherduck-0.1.2.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shipyard_motherduck-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / shipyard_motherduck-0.1.2.tar.gz
| Download URL | shipyard_motherduck-0.1.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e2d9052c4d7b73c1734c9b8254672b00d54929c33c7b6014ca33fb55be00c31
|
|
BLAKE2b-256 checksum How to use checksums |
0bc00d0f327a94453638a2a3d0a8264f2dd0474bd3aeefe3fc201dc74e032e14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Darwin/23.2.0
|
Release files / shipyard_motherduck-0.1.2-py3-none-any.whl
| Download URL | shipyard_motherduck-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3632f8e3722d1f832f9a8739292700e49105090421a000c37787ae141073d437
|
|
BLAKE2b-256 checksum How to use checksums |
d3ba583df3f814282a870040baa403647f1b4df0db5780935788d3d22a6c2fd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Darwin/23.2.0
|