-
Notifications
You must be signed in to change notification settings - Fork 169
Closed as not planned
Description
Hello
I have declared class using declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, VARCHAR, ARRAY
Base = declarative_base()
class Video(Base):
__tablename__ = 'videos'
__table_args__ = {'schema': 'public'}
id = Column(VARCHAR(8192))
categories = Column(ARRAY(VARCHAR(8192)))
While trying to update existing video I change categories to array:
session = sessionmaker(create_engine(conf['snowflake_url']))()
existing_video = session.query(Video).filter_by(id='1').first()
existing_video.categories = ['category1', 'category2']
session.commit()
As a result I see following statement generated
UPDATE entities.videos SET categories='category1' WHERE entities.videos.id = '1'
I believe that something like this should be instead
UPDATE entities.videos SET categories=ARRAY_CONSTRUCT('category1') WHERE entities.videos.id = '1'
Any support of ARRAY, OBJECT, VARIANT on insert is highly appreciated. For example postgresql has it's own JSON type.
holyspecter, ssh2003, olysyuk, mvoitko, SteveAlexander and 6 more