madetech / souper-web-scraping

2 stars 1 forks source link

Fix errors in backend code #60

Closed HorstmannA closed 9 months ago

HorstmannA commented 9 months ago

When I open the repo with VSCode it highlights several errors. They apparently don't prevent the service from running because I can run the application, but include things like type hint inconsistencies.

HorstmannA commented 9 months ago

There are two outstanding error types left:

 Argument of type "FromClause" cannot be assigned to parameter "table" of type "_DMLTableArgument" in function "insert"
  Type "FromClause" cannot be assigned to type "_DMLTableArgument"
    "FromClause" is incompatible with "TableClause"
    "FromClause" is incompatible with "Join"
    "FromClause" is incompatible with "Alias"
    "FromClause" is incompatible with "CTE"
    "FromClause" is incompatible with "type"
    "FromClause" is incompatible with "Inspectable[_HasClauseElement]"
    "FromClause" is incompatible with protocol "_HasClauseElement"
  ...Pylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)

And

  Argument of type "None" cannot be assigned to parameter "constraint_name" of type "str" in function "drop_constraint"
  Type "None" cannot be assigned to type "str"Pylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)
HorstmannA commented 9 months ago

This may become important - Alembic files with op.drop_constraint(None, 'report', type_='unique') would need a table name instead of 'None' https://alembic.sqlalchemy.org/en/latest/naming.html

HorstmannA commented 9 months ago

The target_metadata = [Base.metadata] line was causing an alert, so I removed the square brackets. This seems consistent with the SQLAlchemy documentation: https://alembic.sqlalchemy.org/en/latest/autogenerate.html

And also recommendations like these: https://stackoverflow.com/questions/48053955/alembic-migrations-on-multiple-models