sadpandajoe opened a new pull request, #43351:
URL: https://github.com/apache/superset/pull/43351

   ### SUMMARY
   The "Connect a database" dynamic form for PostgreSQL required a Port value 
and blocked
   connecting when it was left blank, even though PostgreSQL has a well-known 
default port
   (5432) and the SQLAlchemy-URI connection path already worked fine without 
specifying one.
   
   `PostgresEngineSpec` inherited `BasicParametersMixin`'s validation and 
URI-building logic
   unmodified, which requires `port` unconditionally in three places: the 
parameters JSON
   schema exposed to the frontend form, the progressive `validate_parameters` 
check, and
   `build_sqlalchemy_uri`. None of them consulted the engine's own advertised 
default port.
   
   This PR gives `PostgresEngineSpec` its own parameter 
schema/validation/URI-building
   overrides (mirroring the existing pattern in `ClickHouseEngineSpec`) so a 
blank port
   defaults to 5432 instead of blocking the connection, while all other 
validation
   (host resolution, port format/range/openness when a port *is* supplied) is 
unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A at PR-open time — will be added after manual verification.
   
   ### TESTING INSTRUCTIONS
   1. Open **+ > Data > Connect database > PostgreSQL**.
   2. Fill in host/username/password/database but leave **Port** blank.
   3. Click **CONNECT** — the connection should now be attempted using port 
5432 instead of
      being blocked by a "missing parameter" error.
   4. Confirm an explicitly-entered port still works exactly as before, 
including
      port-range/format validation errors.
   
   Automated coverage: `tests/unit_tests/db_engine_specs/test_postgres.py` (13 
new cases
   covering `build_sqlalchemy_uri`'s port defaulting, `validate_parameters`'s 
relaxed
   requirement, and the relaxed parameters schema) and updated
   `tests/integration_tests/db_engine_specs/postgres_tests.py` /
   `tests/integration_tests/databases/{commands_tests,api_tests}.py`.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to