loopback-connector-postgresql icon indicating copy to clipboard operation
loopback-connector-postgresql copied to clipboard

LB4 discover Error after updating libraries to latest

Open ingpconci opened this issue 10 months ago • 1 comments

Steps to reproduce

Updating loopback libraries

"@loopback/authentication": "^11.0.11", "@loopback/authentication-jwt": "^0.15.11", "@loopback/authorization": "^0.15.11", "@loopback/boot": "^7.0.11", "@loopback/context": "^7.0.11", "@loopback/core": "^6.1.8", "@loopback/openapi-v3": "^10.0.11", "@loopback/repository": "^7.0.11", "@loopback/rest": "^14.0.11", "@loopback/rest-explorer": "^7.0.11", "@loopback/service-proxy": "^7.0.11", "loopback-connector-rest": "^5.0.1", and PostgreSQL connector "loopback-connector-postgresql": "^7.1.10",

Current Behavior

The tool lb4 discover --datasource db --schema appuser

failed with the Error:

Error: buildQueryUniqueKeys must be implemented by the connector at SQLConnector.buildQueryUniqueKeys (C:\Users\Paolo Conci\Documents\PROJECTS_LOCAL_WORKSPACE\L_FBK_MNFLims\APP_SERVER\fbk-fablims-server\node_modules\loopback-connector\lib\sql.js:2159:9) at SQLConnector.discoverUniqueKeys (C:\Users\Paolo Conci\Documents\PROJECTS_LOCAL_WORKSPACE\L_FBK_MNFLims\APP_SERVER\fbk-fablims-server\node_modules\loopback-connector\lib\sql.js:2180:20) at DataSource.discoverUniqueKeys (C:\Users\Paolo Conci\Documents\PROJECTS_LOCAL_WORKSPACE\L_FBK_MNFLims\APP_SERVER\fbk-fablims-server\node_modules\loopback-datasource-juggler\lib\datasource.js:1346:20)

Expected Behavior

With the previous libraries "@loopback/authentication": "^11.0.8", "@loopback/authentication-jwt": "^0.15.8", "@loopback/authorization": "^0.15.8", "@loopback/boot": "^7.0.8", "@loopback/core": "^6.1.5", "@loopback/repository": "^7.0.8", "@loopback/rest": "^14.0.8", "@loopback/rest-explorer": "^7.0.8", "@loopback/service-proxy": "^7.0.8", "debug": "^4.3.7", "file-type": "^16.0.0", "jsonwebtoken": "^9.0.0", "loopback-connector-postgresql": "^7.1.5", the tool extracts the DB information from Postgresql

lb4 discover --datasource db --schema appuser ? Select the models which to discover userTodo ? Select a convention to convert db column names(EXAMPLE_COLUMN) to model property names: (Use arrow keys) ? Select a convention to convert db column names(EXAMPLE_COLUMN) to model property names: Camel case (exampleColumn) (Recommended) create src\models\user-todo.model.ts

Link to reproduction sandbox

Additional information

Related Issues

See Reporting Issues for more tips on writing good issues

ingpconci avatar Feb 21 '25 09:02 ingpconci

@ingpconci, thanks for reporting this. It's currently being worked on via https://github.com/loopbackio/loopback-connector-postgresql/pull/743 (cc @aaqilniz ). For now, could you please try to downgrade the loopback-connector to 6.1.12? This feature was introduced in 6.2.0, however, it's missed that there's code change needed for this connector. Thanks.

dhmlau avatar Feb 21 '25 18:02 dhmlau