-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
After updating to 0.11 and running our pipelines as usual an error printed:
File "C:\Users\adrivn\Projects\etl\config\functions.py", line 271, in write_to_table
f'"{col_name}" {col.data_type.ddl()}' for col_name, col in pg_schema.columns
^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable pgpq._pgpq.Column object
After inspection, I ran a test with dummy data and noticed that the Column class does have "data_type" and "nullable" attributes but "name" has gone missing, for some reason.
import polars as pl
from pgpq import ArrowToPostgresBinaryEncoder
test_sch = pl.from_dict({"a": [1,2,3], "words": ["hey", "test", "this"]})
dataset = test_sch.to_arrow()
encoder = ArrowToPostgresBinaryEncoder(dataset.schema)
pg_schema = encoder.schema()
first = next(iter(pg_schema.columns))
print(type(first), dir(first))
Prints:
<class 'pgpq._pgpq.Column'> ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'data_type', 'nullable']
Am I looking at this the wrong way?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels