Experimental changes to allow relational-data-sink implementation to work with different database backends#608
Conversation
|
Just pushed back the change for MS-SQL. The testing result is captured in |
There was a problem hiding this comment.
Pull request overview
This PR adds experimental support for multiple database backends (SQLite, MariaDB, MySQL, MSSQL) to the relational data sink implementation. The changes include updated connection URL examples for each database type and corresponding documentation in comments.
Changes:
- Added connection URL configurations for SQLite, MariaDB, MySQL, and MSSQL
- Updated documentation with examples for each database backend
- Modified test configuration to use SQLite as the default (changed from PostgreSQL)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| stix2/test/v21/test_datastore_relational_db.py | Added commented examples of connection URLs for different database backends; updated store initialization to enable database instantiation; added trailing commas for consistency |
| stix2/datastore/relational_db/relational_db.py | Added comprehensive inline documentation showing connection URL examples for PostgreSQL, SQLite, MariaDB, MySQL, and MSSQL; added trailing comma for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #_DB_CONNECT_URL = f"mariadb+pymysql://{os.getenv('MARIADB_USER')}:{os.getenv('MARIADB_PASSWORD')}@127.0.0.1:3306/rdb" | ||
|
|
||
| # MySQL | ||
| #_DB_CONNECT_URL = f"mysql+pymysql://os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD')@127.0.0.1/rdb" |
There was a problem hiding this comment.
The MySQL connection URL has incorrect syntax. The environment variable calls are inside the URL string without proper f-string interpolation braces. The current syntax os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD') will be interpreted as literal text rather than function calls.
| #_DB_CONNECT_URL = f"mysql+pymysql://os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD')@127.0.0.1/rdb" | |
| #_DB_CONNECT_URL = f"mysql+pymysql://{os.getenv('MYSQL_USER')}:{os.getenv('MYSQL_PASSWORD')}@127.0.0.1/rdb" |
| # at port 3307 using the connect_args dictionary parameter: | ||
| # | ||
| # MySQL: | ||
| # url = f"mysql+pymysql://os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD')@127.0.0.1/rdb" |
There was a problem hiding this comment.
The MySQL connection URL has incorrect syntax. The environment variable calls are inside the URL string without proper f-string interpolation braces. The current syntax os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD') will be interpreted as literal text rather than function calls.
| # url = f"mysql+pymysql://os.getenv('MYSQL_USER'):os.getenv('MYSQL_PASSWORD')@127.0.0.1/rdb" | |
| # url = f"mysql+pymysql://{os.getenv('MYSQL_USER')}:{os.getenv('MYSQL_PASSWORD')}@127.0.0.1/rdb" |
Added test code to scope out the work needed to support the following variants:
Testing has been done on a MacBook Pro M3 system for the first three; the corresponding log file is attached for reference. The code for MSSQL remains to be tested, so consider it as a place holder for now.
sqlite.log
mariadb.log
mysql.log