我有一个google表单,其中包含以下两个字段:
用户将输入他的电子邮件地址并选择工具并单击"提交".我希望看到以下消息:
谢谢你的回复.已发送电子邮件至您输入的电子邮件地址以下载所选工具.
我在脚本编辑器中有以下代码
function emailFormSubmission() {
var form = FormApp.getActiveForm();//the current form
var dest_id = form.getDestinationId(); //the destination spreadsheet where form responses are stored
var ss = SpreadsheetApp.openById(dest_id);//open that spreadsheet
var theFormSheet = ss.getSheets()[0]; //read the first sheet in that spreadsheet
var row = theFormSheet.getLastRow(); //get the last row
var emailid = theFormSheet.getRange(row,2,1,1).getValue();//get column 2 corresponding to the email id. column 1 is timestamp. so, skip …
Run Code Online (Sandbox Code Playgroud) 我们有一个包含两个表的 postgres 数据库Models
,并且Drives
我们使用 sqlalchemy 创建查询来分析这些表中的数据。
Models
表具有以下架构:
CREATE TABLE models (
id SERIAL PRIMARY KEY,
vendor_name character varying(32) NOT NULL,
model character varying(32) NOT NULL,
drive_capacity bigint NOT NULL
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX models_pkey ON models(id int4_ops);
CREATE INDEX idx_models_vendor_name ON models(vendor_name text_ops);
CREATE INDEX idx_models_model ON models(model text_ops);
Run Code Online (Sandbox Code Playgroud)
Models
并由以下类表示tables.py
:
class Models(Base, DeferredReflection):
__tablename__ = "models"
id = Column("id", Integer, primary_key=True)
Run Code Online (Sandbox Code Playgroud)
Drives
表具有以下架构:
CREATE TABLE drives (
id SERIAL PRIMARY …
Run Code Online (Sandbox Code Playgroud) 我试图在主节点和工作节点之间共享数据库中的随机条目列表(我对共享资源的定义),并使用 pytest-xdist 并行化测试。我的代码遵循以下结构:
## in conftest.py
def get_db_entries():
connect to db
run a query with group by and random
returns one random entry per group as a list of dictionaries.
Run Code Online (Sandbox Code Playgroud)
我改编了https://hackebrot.github.io/pytest-tricks/shared_directory_xdist/提供的建议,以在主节点和工作节点之间共享数据库条目:
# in conftest.py
def pytest_configure(config):
if is_master(config):
# share db_entries across master and worker nodes.
config.db_samples = get_db_entries()
def pytest_configure_node(node):
"""xdist hook"""
node.slaveinput['db_entries'] = node.config.db_samples
def is_master(config):
"""True if the code running the given pytest.config object is running in a xdist master
node or not running xdist at …
Run Code Online (Sandbox Code Playgroud) python ×2
google-apps ×1
google-forms ×1
postgresql ×1
pytest ×1
sqlalchemy ×1
sqlite ×1
xdist ×1