Example #1
0
    def test_join_things(self):
        fields = ["url", "sr_id"]
        link = make_link(thing_id=1, timestamp=100.01, url="foo", sr_id=10)
        dump = make_pg_dump(fields, link)
        stdin = StringIO(dump)
        stdout = StringIO()
        mr_tools.join_things(fields, fd=stdin, out=stdout, err=StringIO())

        self.assertEqual(stdout.getvalue().strip(), "1 link 1 0 f f 100.01 foo 10".replace(" ", "\t"))
Example #2
0
 def join_things(self):
     fields = []
     defaults = {}
     for k, typ in self.fields.iteritems():
         fields.append(k)
         if typ is int:
             defaults[k] = 0
         elif typ is str:
             defaults[k] = ""
     mr_tools.join_things(
         fields, fd=self.fd, out=self.out, err=self.err, defaults=defaults
     )
Example #3
0
def join_comments():
    return mr_tools.join_things(('link_id',))
Example #4
0
def join_links():
    mr_tools.join_things(('url',))
Example #5
0
def join_things(thing_type):
    mr_tools.join_things(data_fields_by_name[thing_type].keys())
Example #6
0
def join_comments():
    join_things(('author_id',))
Example #7
0
def join_things(thing_type):
    mr_tools.join_things(data_fields_by_name[thing_type].keys())
def join_links():
    join_things(("author_id", "sr_id"))
def join_links():
    mr_tools.join_things(('author_id',))
Example #10
0
def join_links():
    mr_tools.join_things(('url', ))
Example #11
0
def join_things():
    mr_tools.join_things(('url', 'sr_id', 'author_id'))
Example #12
0
def join_links():
    mr_tools.join_things(('author_id', ))
Example #13
0
def join_comments():
    return mr_tools.join_things(('link_id', ))
Example #14
0
def join_comments():
    join_things(('author_id', ))
Example #15
0
def join_links():
    join_things(('author_id', 'sr_id'))
Example #16
0
def join_things():
    mr_tools.join_things(('url', 'sr_id', 'author_id'))
Example #17
0
def join_links():
    mr_tools.join_things(('url', 'sr_id'))
Example #18
0
def join_links():
    join_things(('author_id', 'sr_id'))
def join_comments():
    join_things(("author_id",))
Example #20
0
def join_links():
    mr_tools.join_things(('url', 'sr_id'))