javascript - 使用原始查询时,Sequelize 无法识别带有 camelCase 名称的表
问题描述
我在 sequelize 中使用原始查询来查询具有骆驼案例名称的表中的数据。代码看起来像这样
const activeProducts = await sequelize.query(
`SELECT ap.*, pd.stack_id stack_id, pd.channel_id channel_id, pd.product_type product_type FROM active_products ap
join productDefinitions pd on ap.product_id = pd.id
WHERE active = \'active\'
`,
{ type: QueryTypes.SELECT }
);
console.log(activeProducts)
return activeProducts;
sequelize 似乎无法识别带有驼峰字母的表名。它不是查找“productDefinitions”,而是查找“productdefinitions”,这是输出
Error: relation "productdefinitions" does not exist
解决方案
我想你正在使用 Postgres。尝试用"
推荐阅读
- node.js - node_modules/graphql-tag/lib/index.d.ts(2,57) 中的 Angular 7 错误:错误 TS1005:“,”预期
- centos - skia/buildtools/linux64/gn: /lib64/libc.so.6: 找不到版本‘GLIBC_2.18’
- aws-lambda - 如何使用 Api Gateway 可视化 Step Function 的输出?
- php - NetSuite PHP Toolkit 时间条目搜索
- java - 将 resteasy-jaxrs 从 3.0.26.Final 升级到 3.12.0.Final 时出现运行时错误
- c# - ClosedXML 未返回正确的单元格值
- spring-boot - 多个用户的单个 Spring Boot 应用程序工作
- security - WinAppDriver 是否提供任何身份验证机制和/或 HTTPS 连接?
- vue.js - 如何在 Nuxt 和 Axios 代理中添加默认参数?
- python - 获取由 pyppeteer 呈现的页面发送的请求的 URL