Skip to main content

UNKNOWN

Project description

sqoopy
======

Python CLI to generate custom [sqoop](http://sqoop.apache.org/) import statements.
Modified from [https://github.com/wikimedia/sqoopy/](https://github.com/wikimedia/sqoopy/).


## Installation

You can install `sqoopy` via `pip`:

```bash
$ pip install sqoopy
```

## Usage

`sqoopy` will generate custom [sqoop](http://sqoop.apache.org/) import statements given a few simple options:

```bash
usage: sqoopy [-h] [-c CONNECT] [-d TARGET_DIR] [-t TABLES]

Python CLI to generate custom sqoop import statements.

optional arguments:
-h, --help show this help message and exit
-c CONNECT, --connect CONNECT
A jdbc connection string.
-d TARGET_DIR, --target-dir TARGET_DIR
The directory to send output to. If sending to s3, use
"{table}" to insert the table name into the directory.
EG: s3://my-bucket/{table}/
-t TABLES, --tables TABLES
(Optional) comma-separated list of tables that need to
be inspected. If not supplied, all tables will be
imported.
```

For example, here is a simple command that will generate an import command given the [test database](tests/test.db):

```bash
$ sqoopy --connect=sqlite:///tests/test.db --target-dir=s3://foo-bar/
```

This will output:

```
sqoop import --connect=sqlite:///tests/test.db --table=test --target-dir=s3://foo-bar/
```

If you'd like to programmatically add the table name to the `target-dir`, use `{table}`:

```
$ sqoopy --connect=sqlite:///tests/test.db --target-dir=s3://foo-bar/{table}
```

This will output:

```
sqoop import --connect=sqlite:///tests/test.db --table=test --target-dir=s3://foo-bar/test/
```

If you'd like to use a custom list of tables to import, use the `--tables` argument, with each table name separated by a comma:

```
$ sqoopy --connect=sqlite:///tests/test.db --target-dir=s3://foo-bar/{table} --tables=test
```

Finally, you can also passthrough any other `sqoop import` arguments:

```bash
$ sqoopy --connect=sqlite:///tests/test.db --target-dir=s3://foo-bar/{table} --tables=test --split-by id --num-mappers 4
```

This will output:

```
sqoop import --connect=sqlite:///tests/test.db --table=test --target-dir=s3://foo-bar/test/ --split-by id --num-mappers 4
```

## Tests

You can run tests by first installing `nose`:

```
$ pip install nose
$ nosetests
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqoopy-0.0.8.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

sqoopy-0.0.8.3.macosx-10.10-intel.exe (108.9 kB view details)

Uploaded Source

File details

Details for the file sqoopy-0.0.8.3.tar.gz.

File metadata

  • Download URL: sqoopy-0.0.8.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sqoopy-0.0.8.3.tar.gz
Algorithm Hash digest
SHA256 6ab887b5fdbeb54b4bb5b08ae430d8dcd36a2d3ba35ba034608a13668e38bd50
MD5 3257c431cf9d23ddb00df44fe7381287
BLAKE2b-256 e9d5a3c75783101d18a760608f0602fbe94b143c4e658f9cde9e1917cecb36d4

See more details on using hashes here.

File details

Details for the file sqoopy-0.0.8.3.macosx-10.10-intel.exe.

File metadata

File hashes

Hashes for sqoopy-0.0.8.3.macosx-10.10-intel.exe
Algorithm Hash digest
SHA256 5780dc3803bdbc71aa6b34ff5db473cd79bd02051ddd5bc4b80039c79727939a
MD5 89bb2fe2fc545835a63b533ee11208f2
BLAKE2b-256 c7fb30b8f7387e4007abcb553eaea34ff8687319e8422c28e5f3b320fd8e77e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page