Example #1
0
def main():
    URL = "projects.csv"

    b = brewery.create_builder()
    b.csv_source(URL,encoding="UTF8")
    b.audit(distinct_threshold=None)
    b.pretty_printer()

    b.stream.run()
Example #2
0
Example: How to use a generator function as a streaming data source.

"""


import brewery
import random

# Create a generator function
def generator(count=10, low=0, high=100):
    for i in range(0, count):
        yield [i, random.randint(low, high)]
        
# Create stream builder (HOM-based)
main = brewery.create_builder()

main.generator_function_source(generator, fields=brewery.FieldList(["i", "roll"]))

# Configure node with this:
#
# main.node.kwargs = {"count":100, "high":10}

# Uncomment this:
#
# fork = main.fork()
# fork.csv_target("random.csv")

main.formatted_printer()
main.stream.run()
Example #3
0
 def test_basic(self):
     main = brewery.create_builder()
     main.csv_source("foo")
     
     self.assertEqual(1, len(main.stream.nodes))
     self.assertEqual("csv_source", main.node.identifier())