Skip to content

Conversation

@mfang90739
Copy link
Contributor

Added test code to scope out the work needed to support the following variants:

  • SQLite
  • MariaDB
  • MySQL
  • Microsoft SQL (MSSQL)

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

@mfang90739
Copy link
Contributor Author

Just pushed back the change for MS-SQL. The testing result is captured in
mssql.log

@CLAassistant
Copy link

CLAassistant commented Jul 31, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
#_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"

Copilot uses AI. Check for mistakes.
# 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"
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants