Skip to main content

Migration from local files to database made simple!

Project description

files-2-db

Uploading data from files to database made easy!

Background

Importing a file from your local machine into a database which is in a remote server is painful process. The exact same process can be done through a command now.

Current implementation

  • File formats supported - .csv
  • Database engines supported - mysql

Usage

The tool can be used in two ways.

  • Through command line, where you do not even need a python script to be created.

    usage: file2db [-h] --host HOST [--port PORT] --user USER --password PASSWORD
                --database DATABASE --table TABLE [--seperator SEPERATOR]
                [--ignore_errors IGNORE_ERRORS] [--n_rows N_ROWS]
                Source-file Target-database
    
    
    file2db - Transfer of data from your local file to Database, made simple.
    
    positional arguments:
    Source-file           Absolute path of the file to be uploaded, with suffix
    Target-database       Target database where the file has to be uploaded
    
    options:
    -h, --help            show this help message and exit
    --host HOST           URL or IP address representation of database host
    --port PORT           Port number to connect to the database
    --user USER           Username for database authentication
    --password PASSWORD   Password for database authentication
    --database DATABASE   Target database
    --table TABLE         Target table to insert the data
    --seperator SEPERATOR
                            Column seperator in the file
    --ignore_errors IGNORE_ERRORS
                            Try to keep reading lines if some lines yield errors. default
                            value -> False
    --n_rows N_ROWS       Number of rows from the file to be inserted to database.
                            Default -> all
    
  • Otherwise, you can access the ingest_data_from_file API of the module. It takes the same set of parameters to the API in the below format,

    def ingest_data_from_file(
        file_path: str,
        target_database: str,
        db_host: str,
        db_port: int,
        db_user: str,
        db_password: str,
        data_db: str,
        data_table: str,
        file_seperator: str,
        ignore_file_errors: bool,
        n_rows_to_insert: int,
    ) -> None:
        ...
    

Roadmap

In upcoming versions, files2db will support commonly used file formats like, .json, .parquet, .tsv, .xlsx, .arrow and the databases, not limited to, postgresql, sqlite, MSSQL and what not.

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

files2db-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

files2db-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file files2db-0.1.0.tar.gz.

File metadata

  • Download URL: files2db-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for files2db-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb7fc6cbd3dd5ccfd49d1bcfe90e9685c8720c2989384ba80108d0c9d3ddae89
MD5 ab96b1d3d14bbb7ed04d37091685749f
BLAKE2b-256 e5825a94db725f64ebc0cd7580ff8738fd4325d5cc766043f6c15374aa4ad884

See more details on using hashes here.

File details

Details for the file files2db-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: files2db-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for files2db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12bd6c7ea0cca94843428cc36a883a30c8091454eec0edfa110122d92c487df4
MD5 b11a00477f4bf83b19633e97f9f4334e
BLAKE2b-256 bed8dd13fbb47b68883625a65adf2fea6bce81719490055e548db5acdb6759c4

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