我想dbt
在我的一个项目中使用(数据构建工具)。我在创建项目或使用 DBT 命令时遇到障碍。
我已经完成了 DBT 网站上所述的安装过程: https: //docs.getdbt.com/v0.10/docs/windows。DBT 安装成功,但是当我尝试使用 DBT 命令创建项目时,出现错误:
“dbt”不被识别为内部或外部命令、可操作程序或批处理文件。
我使用的是 Windows 10,并且我已经尝试过 python 3.6 以及 python 3.7 版本。
任何帮助将不胜感激!谢谢
我目前面临的问题是我在 MongoDB 集合中有文档,每个文档都需要由需要在非循环依赖图中运行的任务进行处理和更新。如果上游任务无法处理文档,则任何依赖任务都无法处理该文档,因为该文档尚未使用先决条件信息进行更新。
如果我要使用 Airflow,这给我留下了两个解决方案:
为每个文档触发一个 DAG,并传入带有--conf
. 问题在于这不是 Airflow 的预期使用方式。我永远不会运行预定的流程,并且根据文档在集合中的显示方式,我每天会制作 1440 个 Dagruns。
每个时期运行一个 DAG 以处理该时期在集合中创建的所有文档。这遵循 Airflow 的工作方式,但问题是如果任务无法处理单个文档,则任何依赖任务都无法处理任何其他文档。此外,如果某个文档需要比其他文档更长的时间来处理任务,则这些其他文档将等待该单个文档继续沿 DAG 执行。
有没有比 Airflow 更好的方法?或者在 Airflow 中是否有比我目前看到的两种方法更好的方法来处理这个问题?
使用prefect,我想从其他两个流创建一个新流。
我得到的错误是A task with the slug "add_num" already exists in this flow.
是否可以更新Flows
使用相同tasks
或Parameters
. 下面是我试图完成的一个最小的例子。`
from prefect import task, Flow, Parameter
@task
def add_one(x):
return x+1
with Flow("Flow 1") as flow_1:
add_num = Parameter("add_num", default=10)
new_num1 = add_one(add_num)
@task
def add_two(y):
return y+1
with Flow("Flow 2") as flow_2:
add_num = Parameter("add_num", default=10)
new_num2 = add_two(add_num)
combo_fl = Flow("Add Numbers")
combo_fl.update(flow_1)
combo_fl.update(flow_2, validate=False)
Run Code Online (Sandbox Code Playgroud)
我确实在 slack 频道上看到了这段代码,它可能与解决这个问题有关,但我不知道如何使用它。
class GlobalParameter(Parameter):
def __init__(self, name, slug=None, *args, …
Run Code Online (Sandbox Code Playgroud) 我有这样的结构:
SqlAlchemy 模型
class MPrueba(Base):
__tablename__ = 'M_pruebas'
idpruebas = Column(Integer, primary_key=True)
idfuentes = Column(ForeignKey('M_fuentes.idfuentes', ondelete='RESTRICT', onupdate='RESTRICT'), index=True)
M_fuente = relationship('MFuente')
class MRegla(Base):
__tablename__ = 'M_reglas'
idreglas = Column(Integer, primary_key=True)
idpruebas = Column(ForeignKey('M_pruebas.idpruebas', ondelete='RESTRICT', onupdate='RESTRICT'), index=True)
nombre = Column(String(40))
M_prueba = relationship('MPrueba')
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,MRegla 类上存在指向 MPrueba 类的关系。这意味着当我对 MRegla 类发出一些 get 请求时,M_prueba 字段应包含来自 MPrueba 类的数据。我如何从 MPrueba 类访问该关系?我想生成一个像这样的 pydantic 模型:
MPrueba 类的 pydantic 模式
class Prueba(BaseModel):
idpruebas: int
idfuentes: int
reglas : # Append the MRegla here
class Config:
orm_mode = True
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助。
我正在尝试使用 python 的这个 pytextrank 库-https: //github.com/DerwenAI/pytextrank/blob/master/example.ipynb 但我无法解决这个错误,早些时候我收到了一个错误,ip.json 可以没有找到,但后来解决了
import pytextrank
import sys
path_stage0="data/ip.json"
path_stage1="o1.json"
with open(path_stage1,'w') as f:
for graf in pytextrank.parse_doc(pytextrank.json_iter(path_stage0)):
f.write("%s\n" % pytextrank.pretty_print(graf._asdict()))
print(pytextrank.pretty_print(graf))
OSError Traceback (most recent call last)
<ipython-input-12-a20b437ea0f1> in <module>
6
7 with open(path_stage1,'w') as f:
----> 8 for graf in pytextrank.parse_doc(pytextrank.json_iter(path_stage0)):
9 f.write("%s\n" % pytextrank.pretty_print(graf._asdict()))
10 print(pytextrank.pretty_print(graf))
~\Anaconda3\lib\site-packages\pytextrank\pytextrank.py in parse_doc(json_iter)
259 print("graf_text:", graf_text)
260
--> 261 grafs, new_base_idx = parse_graf(meta["id"], graf_text, base_idx)
262 base_idx = new_base_idx
263
~\Anaconda3\lib\site-packages\pytextrank\pytextrank.py in parse_graf(doc_id, graf_text, base_idx, spacy_nlp)
185 …
Run Code Online (Sandbox Code Playgroud) python ×3
prefect ×2
python-3.x ×2
airflow ×1
api ×1
cmd ×1
dbt ×1
fastapi ×1
nlp ×1
pydantic ×1
pytextrank ×1
spacy ×1
sqlalchemy ×1
windows ×1