It is a library that connects to IBM Power Systems (IBM i), with pyodbc and SSH connection.
Project description
Systems i Access Client for python
It is a library for access ODBC and SSH from Linux to IBM i (AS400) for python. To connect to IBM i we will need to download a ".deb" file, this library can be downloaded from the IBM page oficial.
IBM ODBC driver (login required) https://www.ibm.com/support/pages/ibm-i-access-client-solutions.
Features [x] Support for Python 3.6
Installation of dependencies
Before installing pyodbc you must install the packages from Debian/Ubuntu systems.
Install python and odbc modules:
sudo apt update
sudo apt install libpq-dev python-dev python3-dev python3.6-dev
sudo apt install build-essential
Install unixodbc:
sudo apt install unixodbc-dev unixodbc
Copy the downloaded iseries odbc driver to the server and install:
sudo apt install ./ibm-iaccess-1.1.0.14-1.0.amd64.deb
Installation
Install pyiaccess:
pip install PyiAccess
Environment Variables
Create a ".env" file at the root of your project to define the environment variables.
IBMI_DSN = YOUR DATABASE
IBMI_HOST = YOUR IP
IBMI_USER = YOUR USER
IBMI_PASSWORD = YOUR PASSWORD
IBMI_PORT = YOUR PORT # It is not required
SFTP_HOST = YOUR IP
SFTP_USER = YOUR USER
SFTP_PASSWORD = YOUR PASSWORD
SFTP_PORT = 22 # Default 22 or change port
SFTP_REMOTE_PATH = "/home/" # Define server path to upload files
Configuration of environment variables of the project or application.
from pyiaccess.engine import set_env
# Define .env file with absolute or complete path.
path_env = '/home/user/proyect/.env'
# Load the environment variables.
set_env(path_env)
Engine Configuration
Creating an engine for data base.
from pyiaccess.engine import create_db
engine = create_db(
hostname=hostname, dsn=dsn, username=username, password=password, port=port
)
engine.connect()
Creating an engine for sftp.
from pyiaccess.engine import create_sftp
engine = create_sftp(
hostname=hostname,
username=username,
password=password,
port=port,
remote_path=remote_path,
)
engine.connect()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PyiAccess-0.2.tar.gz
.
File metadata
- Download URL: PyiAccess-0.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe582241bace110eba5ce8d7a915485b8ea53a54c7fad5782fdfdea8d2f213d |
|
MD5 | 82fe78373a661ea9532c5d5503954689 |
|
BLAKE2b-256 | bf655ac61dd7a2c2e8d7ba33934b39261c2349fa25421305082a82427e28e948 |