shipyard-motherduck


Nameshipyard-motherduck JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA local client for working with Python and MotherDuck
upload_time2024-05-02 18:29:46
maintainerNone
docs_urlNone
authorwrp801
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # shipyard-motherduck 

### Installation 
```bash
python3 -m pip install shipyard-motherduck
```

### Usage 

In order to initalize the client, pass the access token to the `MotherDuckClient` object:

```python3
client = MotherDuckClient("<access_token>")
```

Additionally you can connect to a specifc database by supplying the database to the client:

```python3
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: 

```python3
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:
```python3
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:
```python3 
client.execute_query('DROP TABLE my_new_table')
```



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shipyard-motherduck",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "wrp801",
    "author_email": "wespoulsen@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0b/c0/0d0f327a94453638a2a3d0a8264f2dd0474bd3aeefe3fc201dc74e032e14/shipyard_motherduck-0.1.2.tar.gz",
    "platform": null,
    "description": "# shipyard-motherduck \n\n### Installation \n```bash\npython3 -m pip install shipyard-motherduck\n```\n\n### Usage \n\nIn order to initalize the client, pass the access token to the `MotherDuckClient` object:\n\n```python3\nclient = MotherDuckClient(\"<access_token>\")\n```\n\nAdditionally you can connect to a specifc database by supplying the database to the client:\n\n```python3\nclient = MotherDuckClient(\"<access_token>\", database = 'my_db')\n\n```\n\n\n### Loading Data \n\nThe `upload` method allows for a quick upload of a file to a table in MotherDuck. If the table does not exist,\nit will be created. The target table can also be appended to by setting the `insert_method` to 'append'. \n\nExample: \n\n```python3\nclient.upload(table_name = 'my_new_table', file_path = 'my_data.csv', insert_method = 'replace')\n\n```\n\n### Fetching Data\nThe `fetch` method returns the results of a SQL query as a `DuckDBPyRelation` type. From there, it can be converted to a DataFrame or \nwritten to a file. \n\nExample:\n```python3\nresults = client.fetch('select * from my_new_table')\ndf = results.to_df()\n```\n\n\n### Executing a Query \nThe `execute_query` method executes a SQL query in MotherDuck. The difference between this and the `fetch` method is that this \ndoes not return results and is intended for `ALTER, CREATE, DROP` and other DDL queries. \n\nExample:\n```python3 \nclient.execute_query('DROP TABLE my_new_table')\n```\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A local client for working with Python and MotherDuck",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3ba583df3f814282a870040baa403647f1b4df0db5780935788d3d22a6c2fd1",
                "md5": "f373cdf1192b4525538cb775ceb56723",
                "sha256": "3632f8e3722d1f832f9a8739292700e49105090421a000c37787ae141073d437"
            },
            "downloads": -1,
            "filename": "shipyard_motherduck-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f373cdf1192b4525538cb775ceb56723",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 7607,
            "upload_time": "2024-05-02T18:29:45",
            "upload_time_iso_8601": "2024-05-02T18:29:45.920866Z",
            "url": "https://files.pythonhosted.org/packages/d3/ba/583df3f814282a870040baa403647f1b4df0db5780935788d3d22a6c2fd1/shipyard_motherduck-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bc00d0f327a94453638a2a3d0a8264f2dd0474bd3aeefe3fc201dc74e032e14",
                "md5": "7020e070b9b1957f6b21ab8a53e737ce",
                "sha256": "3e2d9052c4d7b73c1734c9b8254672b00d54929c33c7b6014ca33fb55be00c31"
            },
            "downloads": -1,
            "filename": "shipyard_motherduck-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7020e070b9b1957f6b21ab8a53e737ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5412,
            "upload_time": "2024-05-02T18:29:46",
            "upload_time_iso_8601": "2024-05-02T18:29:46.987985Z",
            "url": "https://files.pythonhosted.org/packages/0b/c0/0d0f327a94453638a2a3d0a8264f2dd0474bd3aeefe3fc201dc74e032e14/shipyard_motherduck-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-02 18:29:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "shipyard-motherduck"
}
        
Elapsed time: 0.24340s