Releases: JustinFrizzell/sqlconnect
v0.3.2
v0.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()
v0.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:
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:
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'
v0.2.1
This release brings:
- Improved documentation in docstrings
- Consistent naming of default configuration files (
sqlconnect.yaml
andsqlconnect.env
)
v0.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:
-
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).
- The home directory path typically looks like
-
Windows:
- On Windows, the home directory path often looks like
C:\Users\username
. - Example path:
C:\Users\justin\connections.yaml
.
- On Windows, the home directory path often looks like
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.
v0.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 filesql_to_df_str(query: str)
returns a pandas DataFrame for a given SQL stringexecute_sql(sql_path: str)
executes a SQL command from a given path to a SQL file, returns Noneexecute_sql_str(command: str)
executes a SQL command from a given SQL string, returns None
v0.0.2
This release enables connections to databases that require usernames and passwords. A separate .env
file is used to store credentials which are dynamically read into python at runtime from the system environment.
v0.0.1
Initial release of SQLconnect.
Features
- Easy database connections using a YAML file.
- Execution of SQL queries directly from .sql files.
- Integration with pandas for seamless data manipulation.