当前位置:网站首页>sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
2022-07-31 12:22:00 【小兜全糖(Cx)】
假如我们有一个model types列是一个Column(Array(Integer))
现有一个需求就是判断数据库的数据与给定的查询array之间是否至少有一个是一致的。假如这个array存的数据是{1,2,3,4} ,查询条件是{1,5,6},则应该返回True
可以使用overlap
query = DBSession.query(Question).order_by(Question.created_at.desc())
query = query.filter(Question.types.overlap([1,5,6]))
https://docs.sqlalchemy.org/en/14/dialects/postgresql.html
边栏推荐
猜你喜欢

Is the working process of the belt you know the story - actionreducerstore

Different lower_case_table_names settings for server ('1') and data dictionary ('0') solution

Exploring Plain Vision Transformer Backbones for Object Detection 论文阅读笔记

Character Functions and String Functions

系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】

ESP8266-Arduino编程实例-HDC1008温度湿度传感器驱动

kubernetes之服务发现

AMBA APB学习记录(AMBA 2.0)

MySQL模糊查询性能优化

MySql模糊查询大全
随机推荐
2022年最新重庆建筑安全员模拟题库及答案
JVS应用中心
The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!
Different lower_case_table_names settings for server ('1') and data dictionary ('0') solution
荣耀手机参数写错,客服认为没错
Cognitive-exercise rehabilitation medical robot application design
Quickly learn database management
ESP8266-Arduino编程实例-MCP9808数字温度传感器驱动
Wearing detection and action recognition of protective gear based on pose estimation
VBA输出日志到工作簿demo
JVS轻应用的组成与配置
Use docker to build mysql master-slave
anaconda虚拟环境安装pytorch gpu版本
Structural controllability of switched linear systems with symmetry constraints
最近两个月谷歌 ad 掉的厉害
Hybrid brain-computer interface system based on steady-state visual evoked potentials and attentional EEG
Docker practical experience: Deploy mysql8 master-slave replication on Docker
am335x 看门狗驱动&看门狗应用例程序
MySQL面试八股文(2022最新整理)
B/S架构模式的一个整体执行流程