sqlalchemy-firebird icon indicating copy to clipboard operation
sqlalchemy-firebird copied to clipboard

support multiple Firebird ports on same host

Open hmoffatt opened this issue 1 year ago • 4 comments

I have two different Firebird servers running on the same host, on different ports. This is so that I can migrate from the old version to the new on a database by database basis. This works fine with sqlalchemy using fdb.

Looking at https://github.com/pauldex/sqlalchemy-firebird/blob/main/sqlalchemy_firebird/firebird.py#L68 , this module assumes that there will only be one Firebird port on the host and updates the host registration with the latest connection port.

Could it instead register each host+port combination individually?

hmoffatt avatar May 28 '24 23:05 hmoffatt

Thanks for your report. I'll look into a solution.

pauldex avatar Apr 05 '25 15:04 pauldex

@hmoffatt I know this was a long time ago, but just checking in: are you still experiencing this issue? Or can we go ahead and close it?

Looking at the source code, everything looks fine to me. It should extract the port from the URI if provided, or default to 3050 otherwise.

fdcastel avatar Jul 04 '25 01:07 fdcastel

HI @fdcastel , it will extract the port and use it, but it won't support multiple connections to the same host_name on different ports. At https://github.com/pauldex/sqlalchemy-firebird/blob/main/sqlalchemy_firebird/firebird.py#L86 , the server is registered by host name only, so it is not possible to have concurrent connections to different servers on the same host. When you try to connect to a second port it will see the existing registration and re-use that instead.

I no longer have this requirement, so this doesn't matter to me any more, but I think the server_name passed to get_server() and register_server() just needs to incorporate the port number as well as the host name.

hmoffatt avatar Jul 04 '25 02:07 hmoffatt

Thanks for the feedback, @hmoffatt!

NOW I can see the issue. 👍🏻

fdcastel avatar Jul 04 '25 03:07 fdcastel