Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
datawarehouse-connector
Advanced tools
A Python module to establish connections to various data warehouses like Snowflake, Redshift, and PostgreSQL.
This README.md
file provides comprehensive instructions for installing, setting up, and using the Data Warehouse Connector
module, ensuring users can easily establish connections to their data warehouses.
Requires DB_SOURCE
, USERNAME
, HOST
, PASSWORD
, ROLE
, WAREHOUSE
, and DATABASE
.
from datawarehouse_connector.connector import get_session
snowflake_creds = {
"db_source": "snowflake",
"user": "user",
"password": "password",
"role": "role",
"warehouse": "warehouse",
"database": "database",
"host": "host",
}
session = get_session(snowflake_creds)
session.close()
If network policy is activated in the snowflake account and incoming ips are not allowed or restricted then need to whitelist our StepFunction IP :
Please follow the below steps for the same :
Navigate to the Admin->Security section by clicking on "Admin" in the left navigation panel
Switch to Network Rules. Create a new rule by clicking on + Network Rule button a. Name: SFN_RULE b. Choose Type: IPv4 and Mode: Ingress c. Under Identifiers -> Add IP 18.210.244.167
Switch to Network Policy. Create a new policy by clicking on + Network Policy button a. Name: SFN_POLICY b. Under Allowed Section & Under Select Rule Dropdown select SFN_RULE then click on Create button to create the policy. c. Click on the dotted icon(...) at the end of the policy name and click Activate to start the policy.
Navigate back to the worksheet and replace placeholder with the StepFunctions public IP address.
ALTER NETWORK POLICY SFN_POLICY SET ALLOWED_IP_LIST=('18.210.244.167')
Requires DB_SOURCE
, USERNAME
, HOST
, PASSWORD
, and DATABASE
.
### Direct Connection (Redshift in Public Subnet)
from datawarehouse_connector.connector import get_session
**Database Connection Configuration**
redshift_creds = {
"db_source": "redshift",
"user": "user",
"password": "password",
"database": "database",
"host": "host"
}
session = get_session(redshift_creds)
session.close()
### SSH Tunnel Connection (Redshift in Private Subnet)
#### Purpose
Connect to Amazon Redshift via an SSH tunnel when it's located in a private subnet, and the connecting instance (EC2) is in a public subnet.
you need to provide the SSH details and private key content to establish an SSH tunnel.
#### Prerequisites
SSH Host: The hostname or IP address of the EC2 instance that has access to the Redshift cluster.
SSH Username: The username to log into the EC2 instance.
SSH PEM File Content: The content of the PEM file (private key) used to authenticate the SSH connection.
redshift_creds = {
"db_source": "redshift",
"user": "user",
"password": "password",
"database": "database",
"host": "host",
'ssh_host': 'ssh_host',
'ssh_username': 'ssh_username',
'ssh_pem_file_content': '''ssh_pem_file_content'''
}
session = get_session(redshift_creds)
session.close()
Requires DB_SOURCE
, USERNAME
, HOST
, PASSWORD
, and DATABASE
.
from datawarehouse_connector.connector import get_session
postgresql_creds = {
"db_source": "postgresql",
"user": "user",
"password": "password",
"database": "database",
"host": "host",
}
session = get_session(postgresql_creds)
session.close()
Once the session is established, you can interact with your data warehouse using SQLAlchemy's ORM capabilities.
The get_session
method prints exceptions to help identify issues during the connection process. Ensure that the provided connection details are accurate and the data warehouse is accessible.
This module simplifies the process of connecting to various data warehouses. Follow the setup instructions carefully, and refer to the examples for guidance on using the get_session
function. For further assistance, check the documentation or raise an issue on the project's GitHub repository.
FAQs
A package for database session management
We found that datawarehouse-connector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.