arijeetmukherjee3108-droid opened a new pull request, #41817: URL: https://github.com/apache/beam/pull/41817
### Problem 1. **Invalid `NamedTuple` class names from `table_name`**: In the RAG SQL/Spanner writers (`mysql.py`, `postgres.py`, `spanner.py`), dynamically generated `NamedTuple` schema classes derive their name from `table_name`. Schema-qualified or hyphenated table names (e.g., `my_schema.my_table` or `my-table`) are not valid Python identifiers and cause `NamedTuple` creation to fail. 2. **Mutable default / `None` handling for `column_specs`**: `AlloyDBVectorWriterConfig`, `CloudSQLPostgresVectorWriterConfig`, `CloudSQLMySQLVectorWriterConfig`, `PostgresVectorWriterConfig`, `MySQLVectorWriterConfig`, and `SpannerVectorWriterConfig` used mutable list defaults (`ColumnSpecsBuilder.with_defaults().build()`) and did not cleanly accept `column_specs=None`. ### Changes - Sanitize `table_name` into a valid Python identifier before using it as a `NamedTuple` name in the RAG MySQL, Postgres, and Spanner writers. - Change `column_specs` default to `None` (`Optional[list[ColumnSpec]] = None`) across `alloydb.py`, `cloudsql.py`, `mysql.py`, `postgres.py`, and `spanner.py`, falling back to default column specs when `column_specs is None`. - Add unit tests in `mysql_test.py`, `postgres_test.py`, and `spanner_test.py` covering sanitized `table_name` handling and `column_specs=None`. ### Testing - `pytest apache_beam/ml/rag/ingestion/mysql_test.py apache_beam/ml/rag/ingestion/postgres_test.py apache_beam/ml/rag/ingestion/spanner_test.py` (14 passed) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
