python - 如何在字符串中插入列值?
问题描述
如何在字符串中插入列值(postgres,python)
select * from table where title ~* '\y(?:ROW_VALUE_HERE)\y'
解决方案
使用字符串连接运算符||
select * from table where title ~* '\y(?:' || my_column || ')\y';
或format
功能:
select * from table where title ~* format('\y(?:%s)\y', my_column)';
推荐阅读
- java - model.addAttribute() 对于每个循环
- css - 无法让媒体查询发挥作用
- c# - 我需要从 ICollection 填充 lambda 查询
- angular - 在 NodeJs 上部署 Angular 7 应用程序时出现 OpenShift CrashLoopBackOff 错误
- python - Ansible:从字典中删除一个项目
- webpack - 如何在带有 webpack 的文件加载器中使用排除选项?
- bash - 为什么要在复制/粘贴到终端之前运行 cat|bash ?
- python - Splunk 使用 Python SDK 将 GCP 中的 csv 加载到 KVStore 查找中
- react-native - React Native datetimepicker 问题。在这段代码中为什么 Platform.OS==='ios'?true:false?
- google-apps-script - 用于复制和粘贴新的谷歌表单回复的脚本