如何在 Rhino ETL DSL 中使用 FluentFile?
我一直在研究 Rhino ETL 库,并且非常喜欢它的发展方向。 然而,我发现它的缺点是文档很少,并且似乎没有足够的关于如何创建这些管道流程(尤其是使用 DSL)的好信息。
我只是尝试创建一个 DSL 文件来加载文件并将数据导出到另一个文件中,看看这一切如何组合在一起。 到目前为止我所拥有的是这个。
[DelimitedRecord("\t")]
class User:
public Name as string
public Phone as string
public Email as string
operation import_file:
file = Rhino.Etl.Core.Files.FluentFile(typeof(User)).From("""E:\Fake\Book1.txt""")
for row in file:
yield Row.FromObject(row)
operation export_file:
file = Rhino.Etl.Core.Files.FluentFile(typeof(User)).To("""E:\Fake\Test.txt""")
for row in rows:
record = User(Name: row["Name"])
file.Write(record)
process ImportFile:
import_file()
export_file()
它抛出此异常
File.boo(1,2): BCE0064: Boo.Lang.Compiler.CompilerError: 找不到名称为“DelimitedRecord”或“DelimitedRecordAttribute”的属性(属性名称不区分大小写)。 您的意思是 'System.Diagnostics.DelimitedListTraceListener' 吗?
如果我删除属性部分,则会收到此错误
异常:无法创建管道导入文件:用户类必须使用 [DelimitedRecord] 或 [FixedLengthRecord] 属性进行标记。 异常:无法执行 File.import_file 操作:类 User 必须使用 [DelimitedRecord] 或 [FixedLengthRecord] 属性进行标记。
这里有什么想法吗? 或者有没有关于如何在 DSL 中使用 FluentFile 进行 Rhino ETL 的示例?
I have been playing around with the Rhino ETL library and really like the direction that it's going. However I have found that the bad part about it is the documentation is sparse and there doesn't seem to be enough good information on how to create these pipeline processes and especially using the DSL.
I am just attempting to create a DSL file to load a file and export the data into another file to see how this all could fit together. What I have so far is this.
[DelimitedRecord("\t")]
class User:
public Name as string
public Phone as string
public Email as string
operation import_file:
file = Rhino.Etl.Core.Files.FluentFile(typeof(User)).From("""E:\Fake\Book1.txt""")
for row in file:
yield Row.FromObject(row)
operation export_file:
file = Rhino.Etl.Core.Files.FluentFile(typeof(User)).To("""E:\Fake\Test.txt""")
for row in rows:
record = User(Name: row["Name"])
file.Write(record)
process ImportFile:
import_file()
export_file()
It throws this exception
File.boo(1,2): BCE0064: Boo.Lang.Compiler.CompilerError: No attribute with the name 'DelimitedRecord' or 'DelimitedRecordAttribute' was found (attribute names are case insensitive). Did you mean 'System.Diagnostics.DelimitedListTraceListener' ?
If I remove the attribute part I get this error
Exception: Failed to create pipeline ImportFile: The class User must be marked with the [DelimitedRecord] or [FixedLengthRecord] Attribute.
Exception: Failed to execute operation File.import_file: The class User must be marked with the [DelimitedRecord] or [FixedLengthRecord] Attribute.
Any ideas here? Or are there any examples of how to use the FluentFile within a DSL for Rhino ETL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DelimitedRecordAttribute 位于FileHelpers 程序集,FileHelpers 命名空间。
The DelimitedRecordAttribute is in the FileHelpers assembly, FileHelpers namespace.