Metadata-Version: 2.1
Name: duckdb-utils
Version: 0.1.0a0
Home-page: https://github.com/Florents-Tselai/duckdb-utils
Author: Florents Tselai
License: BSD License
        
        Copyright (c) 2024, Florents Tselai <florents@tselai.com>
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without modification,
        are permitted provided that the following conditions are met:
        
        * Redistributions of source code must retain the above copyright notice, this
          list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright notice, this
          list of conditions and the following disclaimer in the documentation and/or
          other materials provided with the distribution.
        
        * Neither the name of the copyright holder nor the names of its
          contributors may be used to endorse or promote products derived from this
          software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
        WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
        INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
        BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
        OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
        OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
        OF THE POSSIBILITY OF SUCH DAMAGE.
        
        
Project-URL: Issues, https://github.com/Florents-Tselai/duckdb-utils/issues
Project-URL: CI, https://github.com/Florents-Tselai/duckdb-utils/actions
Project-URL: Changelog, https://github.com/Florents-Tselai/duckdb-utils/releases
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools
Requires-Dist: pip
Requires-Dist: sqlite-utils
Requires-Dist: duckdb
Requires-Dist: tabulate
Requires-Dist: click
Requires-Dist: click-default-group >=1.2.3
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: black ; extra == 'test'
Requires-Dist: ruff ; extra == 'test'

# duckdb-utils: CLI tool and Python library for manipulating DuckDB databases

[![Github](https://img.shields.io/static/v1?label=GitHub&message=Repo&logo=GitHub&color=green)](https://github.com/Florents-Tselai/duckdb-utils)
[![PyPI](https://img.shields.io/pypi/v/duckdb-utils.svg)](https://pypi.org/project/duckdb-utils/)
[![Documentation Status](https://readthedocs.org/projects/duckdb-utils/badge/?version=stable)](http://duckdb-utils.tselai.com/en/latest/?badge=stable)
[![Linkedin](https://img.shields.io/badge/LinkedIn-0077B5?logo=linkedin&logoColor=white)](https://www.linkedin.com/in/florentstselai/)
[![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=pink)](https://github.com/sponsors/Florents-Tselai/)
[![pip installs](https://img.shields.io/pypi/dm/duckdb-utils?label=pip%20installs)](https://pypi.org/project/duckdb-utils/)
[![Tests](https://github.com/Florents-Tselai/duckdb-utils/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Florents-Tselai/duckdb-utils/actions?query=workflow%3ATest)
[![codecov](https://codecov.io/gh/Florents-Tselai/duckdb-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/Florents-Tselai/duckdb-utils)
[![License](https://img.shields.io/badge/BSD%20license-blue.svg)](https://github.com/Florents-Tselai/duckdb-utils/blob/main/LICENSE)

**Inspired by [sqlite-utils]**

## CLI

```shell
Usage: duckdb-utils [OPTIONS] COMMAND [ARGS]...

  Commands for interacting with a DuckDB database

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  query*
  create-table  Add a table with the specified columns.
  insert        Insert records from FILE into a table, creating the table...
  tables        List the tables in the database
  views         List the views in the database
```

### ```duckdb-utils create-table```

```shell
Usage: duckdb-utils create-table [OPTIONS] PATH TABLE COLUMNS...

  Add a table with the specified columns. Columns should be specified using
  name, type pairs, for example:

      duckdb-utils create-table my.db people \
          id integer \
          name text \
          height float \
          photo blob --pk id

  Valid column types are text, integer, float and blob.

Options:
  --pk TEXT                 Column to use as primary key
  --not-null TEXT           Columns that should be created as NOT NULL
  --default <TEXT TEXT>...  Default value that should be set for a column
  --fk <TEXT TEXT TEXT>...  Column, other table, other column to set as a
                            foreign key
  --ignore                  If table already exists, do nothing
  --replace                 If table already exists, replace it
  --transform               If table already exists, try to transform the
                            schema
  --load-extension TEXT     Path to SQLite extension, with optional
                            :entrypoint
  --strict                  Apply STRICT mode to created table
  -h, --help                Show this message and exit.
```

