Skip to main content

This is a python utility that allows users to import/export data to/from a database.

Project description

BCP

< badges will go here >

This is a python utility that allows users to import/export data to/from a database.


Overview

This library began as a wrapper around SQL Server's BCP utility. It makes some assumptions about parameters to simplify the interface and allow the user to work natively in python. Though it currently supports MSSQL, there are plans to extend support to other database dialects.

Requirements

  • Python 3.6+

This library purposely requires no python packages outside of the standard library, beyond testing and documentation needs. The intention is to maintain this status. However, you will need to have the appropriate command line utilities installed for the specific database dialects with which you'll interact. For example, if your database is a MS SQL SERVER instance, you'll need BCP installed. Consult the table below for further documentation, including download files and instructions.

RDBMS Utility Documentation / Installation
MS SQL Server BCP https://docs.microsoft.com/en-us/sql/tools/bcp-utility

Installation

This library is still in development. So you'll have to build it from source in the meantime. I'll soon get around to publishing it on pypi, in which case you'll be able to install it using pip

pip install bcp

Examples

Import data:

import bcp

conn = bcp.Connection(host='HOST', driver='mssql', username='USER', password='PASSWORD')
my_bcp = bcp.BCP(conn)
file = bcp.DataFile(file_path='path/to/file.csv', delimiter=',')
my_bcp.load(input_file=file, table='table_name')

Export data:

import bcp

conn = bcp.Connection(host='HOST', driver='mssql', username='USER', password='PASSWORD')
my_bcp = bcp.BCP(conn)
file = bcp.DataFile(file_path='path/to/file.csv', delimiter=',')
my_bcp.dump(query='select * from sys.tables', output_file=file)

Full Documentation

For the full documentation, please visit: https://bcp.readthedocs.io/en/latest/

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

bcp-0.4.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

bcp-0.4.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file bcp-0.4.0.tar.gz.

File metadata

  • Download URL: bcp-0.4.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for bcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 470b6579bd376d8f8f34b3afc3db1da48ecc3f0346884741381cd0d3ec70cbc8
MD5 8d3655153ea5a72f3ac3328eaf5bf77d
BLAKE2b-256 390d1b26173d7e8f3a6fe6b6c276b9c641595e778f74e050d2256d3b3fd8ea7b

See more details on using hashes here.

File details

Details for the file bcp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: bcp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for bcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbd865557925fe7b269bf48a093b72cdd583ba624e71440e6c27f741fc63b81a
MD5 32088e69cac940b5c8a9be8cc25e6642
BLAKE2b-256 6c06f976ffeb528f5137080c5041d424b644891280e8df378152806e85020e4a

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