Sqlconnect

Latest version: v0.3.2

Safety actively analyzes 682244 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

0.3.2

This release includes updates to documentation.

0.3.1

This patch release:

- Fixes issue where incorrect kwarg "conn" was being passed to pd.read_sql_query().
- Now explicitly passes kwargs to pd.read_sql_query()

0.3.0

This release brings:

**Updates to the Sqlconnector class**
- All key word arguments used in pandas.read_sql_query() can now be used in sql_to_df() and sql_to_df_str()
- Added df_to_sql() method for creating / updating SQL tables from DataFrames
- Updated docs to reflect recent changes

**Update to the yaml structure**

This structure is now more generic for compatibility with Postgres, MySQL and Oracle database management systems.

The config module now uses the SQLAlchemy URL.create() method to create the connection URL. This method handles edge cases like the '' symbol in passwords and automatically provides port numbers.

The new structure is generally not expected to change in future.

Previous structure:
YAML
connections:
Mssql:
sqlalchemy_driver: 'mssql+pyodbc'
server: 'mssql_db:1433'
odbc_driver: 'ODBC+Driver+17+for+SQL+Server'
database: 'master'
username: '${MSSQL_USERNAME}'
password: '${MSSQL_PASSWORD}'


New Structure:
YAML
connections:
Mssql:
dialect: 'mssql'
dbapi: 'pyodbc'
host: 'mssql_db'
database: 'master'
username: '${MSSQL_USERNAME}'
password: '${MSSQL_PASSWORD}'
options:
driver: 'ODBC Driver 17 for SQL Server'

0.2.1

This release brings:
- Improved documentation in docstrings
- Consistent naming of default configuration files (`sqlconnect.yaml` and `sqlconnect.env`)

0.2.0

This release brings several updates:

When setting up a database connection, SQLconnect will now check the root of the project for a connections.yaml and .env file. If one or both cannot be found, it will check the users home directory. Saving the configuration files in the home directory is useful if different projects need to share the same configuration, or if you want to reduce the chance of accidently committing .env to version control.

Here are example absolute paths for the home directory it will search on different operating systems:

1. **macOS/Linux**:
- The home directory path typically looks like `/Users/username` on macOS and `/home/username` on most Linux distributions.
- Example path: `/Users/justin/connections.yaml` (macOS) or `/home/justin/connections.yaml` (Linux).

2. **Windows**:
- On Windows, the home directory path often looks like `C:\Users\username`.
- Example path: `C:\Users\justin\connections.yaml`.

Also:

- Exposed the sqlalchmey engine as a property of the SQLconnector class allowing for more direct integration with core sqlalchemy functionality.
- Added unit tests to cover the config and connector modules using the pytest framework.
- Improved docstrings.
- Added example environment variable .env file.
- Added documentation using sphinx framework.

0.1.0

This release includes new SQL functions:

- `sql_to_df(query_path: str)` returns a pandas DataFrame for a given path to a SQL file
- `sql_to_df_str(query: str)` returns a pandas DataFrame for a given SQL string
- `execute_sql(sql_path: str)` executes a SQL command from a given path to a SQL file, returns None
- `execute_sql_str(command: str)` executes a SQL command from a given SQL string, returns None

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.