-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from treeverse/samples-use-python-wrapper-v1.0
Changed many samples to use new Python wrapper
- Loading branch information
Showing
19 changed files
with
2,125 additions
and
7,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from pyspark.sql.types import StructType, StructField, IntegerType, StringType | ||
import os | ||
|
||
def print_diff(diff): | ||
results = map( | ||
lambda n:[n.path,n.path_type,n.size_bytes,n.type], | ||
diff) | ||
|
||
from tabulate import tabulate | ||
print(tabulate( | ||
results, | ||
headers=['Path','Path Type','Size(Bytes)','Type'])) | ||
|
||
def print_commit(log): | ||
from datetime import datetime | ||
from pprint import pprint | ||
|
||
print('Message:', log.message) | ||
print('ID:', log.id) | ||
print('Committer:', log.committer) | ||
print('Creation Date:', datetime.utcfromtimestamp(log.creation_date).strftime('%Y-%m-%d %H:%M:%S')) | ||
print('Parents:', log.parents) | ||
print('Metadata:') | ||
pprint(log.metadata) |
Oops, something went wrong.