Giter Site home page Giter Site logo

pythonbcp's Introduction

Python BCP

Overview

Python BCP is a python module that facilitates direct BCP data transfers to a SQL Server database

Build requirements

FreeTDS is required, as are the Python development headers and libraries.

Running setup.py works as you'd normally expect

Windows

On Windows, Anaconda is recommended

See:

TODO

  • Test suite
  • OSX build

pythonbcp's People

Contributors

damionw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pythonbcp's Issues

Malformed data being sent to the database

I'm not sure how much it's a bug and how much some kind of "undocumented behavior".
environment: CentOS 7, Python 3.7.7, package installed with pip install .
My code:

@contextmanager
def connection():
    bcp_connection = bcp.Connection(
        server="*", username="*", password="*", database="*", batchsize=16,
    )
    yield bcp_connection
    bcp_connection.disconnect()


def main():
    datasets = [
        [[1, 1], [2, 2]],
        [[5, 5], [6, 6]],
        [[1, 1], [2, 2]]  # this should cause a PK conflict
    ]
    with connection() as bcp_connection:
        for data in datasets:
            bcp_connection.init(TABLE)
            for row in data:
                bcp_connection.send(row)
            bcp_connection.commit()


if __name__ == "__main__":
    main()

Final result in database is:

1		1
2		2
35848246	35848246
1726742581	1726742581
35848242	35848242
1726742577	1726742577

Everything works as it should when I make a reconnection after each commit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.