小编mot*_*oto的帖子

使用参数在原始 SQL Alchemy 查询中选择表

我没有使用 ORM,我希望这样做:

table = 'foo'
engine.execute('SELECT * from %s', (table))
Run Code Online (Sandbox Code Playgroud)

问题是变成了:

SELECT * FROM 'foo'
Run Code Online (Sandbox Code Playgroud)

代替

SELECT * FROM foo
Run Code Online (Sandbox Code Playgroud)

我找不到有关可用 % 参数的文档。我试过 %b 但它不受支持。

在不使用 ORM 的情况下,最好的方法是什么?

python mysql sqlalchemy

6
推荐指数
0
解决办法
1028
查看次数

使用 Widget 进行 Cloudinary 签名上传

文档非常令人沮丧。

我正在使用上传小部件来尝试允许用户为其个人资料上传多张图片。我不能使用未签名的上传,因为可能会被滥用。

我宁愿通过上传小部件而不是通过服务器上传文件,因为它看起来应该如此简单

我已经拼凑了我认为应该有效的内容,但它仍然说:Upload preset must be whitelisted for unsigned uploads

服务器:

// grab a current UNIX timestamp
const millisecondsToSeconds = 1000;
const timestamp = Math.round(Date.now() / millisecondsToSeconds);
// generate the signature using the current timestmap and any other desired Cloudinary params
const signature = cloudinaryV2.utils.api_sign_request({ timestamp }, CLOUDINARY_SECRET_KEY);
// craft a signature payload to send to the client (timestamp and signature required)
return signature;
Run Code Online (Sandbox Code Playgroud)

也尝试过

return {
  signature,
  timestamp,
};
Run Code Online (Sandbox Code Playgroud)

也尝试过

const signature = cloudinaryV2.utils.api_sign_request(
      data.params_to_sign,
      CLOUDINARY_SECRET_KEY,
    ); …
Run Code Online (Sandbox Code Playgroud)

javascript upload node.js cloudinary

1
推荐指数
1
解决办法
902
查看次数

标签 统计

cloudinary ×1

javascript ×1

mysql ×1

node.js ×1

python ×1

sqlalchemy ×1

upload ×1