googleapis / python-bigquery-sqlalchemy

SQLAlchemy dialect for BigQuery
MIT License
434 stars 129 forks source link

tests.sqlalchemy_dialect_compliance.test_dialect_compliance.EnumTest_bigquery+bigquery: test_round_trip[a%] failed #1102

Closed flaky-bot[bot] closed 2 months ago

flaky-bot[bot] commented 2 months ago

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and I will stop commenting.


commit: f9324e35a6aa2f3d9c9f2511d1104fdf60c97c83 buildURL: Build Status, Sponge status: failed

chalmerlowe commented 2 months ago

Based on my research, sqlalchemy includes an Enum object using the keyword "_enums" when trying to call sqlalchemy/util/langhelpers.py", line 1415, in constructor_copy() which attempts to create another object. This ultimately leads to an attempt to create a BQString object. BQString inherits from sqlalchemy's String object, which initializes with just length and collation.

def __init__(
        self,
        length: Optional[int] = None,
        collation: Optional[str] = None,
    ):

Thus when we attempt to initialize with a kw argument that includes content beyond length and collation, we get this error:

TypeError: String.__init__() got an unexpected keyword argument '_enums'

The function constructor_copy has code that is supposed to pare down the keywords, but it appears that it does not do it in all circumstances (ie. when kw comes to the table with pre-existing keywords).

names = get_cls_kwargs(cls)
kw.update(
    (k, obj.__dict__[k]) for k in names.difference(kw) if k in obj.__dict__
)
return cls(*args, **kw)
chalmerlowe commented 2 months ago
Screenshot 2024-08-13 at 10 22 04 AM
chalmerlowe commented 2 months ago

I issues a discussion on sqlalchemy's github to see if this is a known issue, a mistake on my part, or a actual bug.

https://github.com/sqlalchemy/sqlalchemy/discussions/11734

flaky-bot[bot] commented 2 months ago

commit: 75569f487cd7dffe833d7c857cd4822b732b723f buildURL: Build Status, Sponge status: failed