diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c14ecc8..0000000 --- a/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -target/ -.DS_Store -.idea/ -.iml - -# spark-testing-base runtime files -derby.log - -# Ensime -.ensime* - -bin/.coursier -bin/.scalafmt-* - diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/.scalafmt.conf b/.scalafmt.conf deleted file mode 100644 index cce2891..0000000 --- a/.scalafmt.conf +++ /dev/null @@ -1,18 +0,0 @@ -# Apply to select versioned file -project.git = true - -# Styles -style = defaultWithAlign -maxColumn = 100 -docstrings = JavaDoc -assumeStandardLibraryStripMargin = true -optIn.breakChainOnFirstMethodDot = true -align.openParenCallSite = false -align.openParenDefnSite = false -runner.optimizer.forceConfigStyleMinArgCount = 4 - -# Rewrite rules -rewrite.rules = [ - RedundantBraces, - RedundantParens -] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9539e82..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: scala -sudo: false - -scala: - - 2.11.8 - -jdk: oraclejdk8 - -script: - - bin/scalafmt --test - - sbt ++$TRAVIS_SCALA_VERSION test - -before_cache: - # See http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm - -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot - - $HOME/.coursier diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index b8f8a7d..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -# Contributing - -Bugs and feature requests should be reported in the [GitHub issue -tracker](https://github.com/mediative/amadou/issues/new) and -answer the following questions: - - - Motivation: Why should this be addressed? What is the purpose? - - Input: What are the pre-conditions? - - Output: What is the expected outcome after the issue has been addressed? - - Test: How can the results listed in the "Output" be QA'ed? - -For code contributions, these are the suggested steps: - - - Identify the change you'd like to make, e.g. fix a bug or add a feature. - Larger contributions should always begin with [first creating an - issue](https://github.com/mediative/amadou/issues/new) to ensure - that the change is properly scoped. - - Fork the repository on GitHub. - - Develop your change on a feature branch. - - Write tests to validate your change works as expected. - - Create a pull request. - - Address any issues raised during the code review. - - Once you get a "+1" on the pull request, the change can be merged. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d645695..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index 3fdb4f4..0000000 --- a/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# Amadou - Ignite your Spark ETL jobs -[![Build Status]][Travis] -[![Latest version]][Bintray] - - [Build Status]: https://travis-ci.org/mediative/amadou.svg?branch=master - [Travis]: https://travis-ci.org/mediative/amadou - [Latest version]: https://api.bintray.com/packages/mediative/maven/amadou-core/images/download.svg - [Bintray]: https://bintray.com/mediative/maven/amadou-core/_latestVersion - -> Amadou was a precious resource to ancient people, allowing them to start a -> fire by catching sparks from flint struck against iron pyrites. -> -- [Wikipedia] - - [Wikipedia]: https://en.wikipedia.org/wiki/Amadou - -## Getting Started - -Add the following to your `build.sbt`: - -```sbt -resolvers += Resolver.bintrayRepo("mediative", "maven") -libraryDependencies += "com.mediative" %% "amadou-core" % "0.4.4" -``` - -See the [TestEtl] job to get an idea of what the library provides. - - [TestEtl]: core/src/test/scala/com.mediative.amadou/test/TestEtl.scala - -## Documentation - - - [Scaladoc](https://mediative.github.io/amadou/api/#com.mediative.amadou.package) - -## Building and Testing - -This library is built with sbt, which needs to be installed. Run the following command from the project root, to build and run all test: - - $ sbt test - -See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute. - -## Releasing - -To release version `x.y.z` run: - - $ sbt -Dversion=x.y.z release - -This will run the tests, create a tag and publishing JARs and API docs. - -## License - -Copyright 2017 Mediative - -Licensed under the Apache License, Version 2.0. See LICENSE file for terms and -conditions for use, reproduction, and distribution. diff --git a/api/com/mediative/amadou/ConfigLoader.html b/api/com/mediative/amadou/ConfigLoader.html new file mode 100644 index 0000000..3d929ab --- /dev/null +++ b/api/com/mediative/amadou/ConfigLoader.html @@ -0,0 +1,1088 @@ + + +
+Value reader for optionally loading properties from a file.
Value reader for optionally loading properties from a file.
When the named path does not exists an empty Properties instance is returned +
case class Database(url: String, properties: Properties)
Run a sequence of database scripts.
+Base class for date intervals.
The interval is represented as the half open range between from
and to
.
+For instance, May 2014 is represented as from = 2014-05-01
, to = 2014-06-01
.
Example:
scala> Seq(Day(2016, 8, 11), Week(2016, 32), Month(2016, 8), Quarter(2016, Quarter.Q3), Year(2016)) +res1: Seq[DateInterval] = List(2016-08-11, 2016-W32, 2016-08, 2016-Q3, 2016)
Iterate over all days in this date interval.
Iterate over all days in this date interval.
Example:
scala> Week(2016, 11).by(Day).size +res1: Int = 7 +scala> Week(2016, 11).by(Day).toList +res2: List[DateInterval] = List(2016-03-14, 2016-03-15, 2016-03-16, 2016-03-17, 2016-03-18, 2016-03-19, 2016-03-20)
Returns the subsequent corresponding date interval (eg.
Returns the subsequent corresponding date interval (eg. 2014 -> 2015).
Example:
scala> Year(2014).next +res1: DateInterval = 2015
Returns the preceding corresponding date interval (eg.
Returns the preceding corresponding date interval (eg. May -> April).
Example:
scala> Month(2016, 5).prev +res1: DateInterval = 2016-04
Define a custom interval.
Define a custom interval.
Example:
scala> Month(2016, 8) to Day(2016, 8, 29) +res1: DateInterval = 2016-08:2016-08-29 +scala> (Day(2016, 8, 11) to Day(2016, 8, 29)).by(Day).size +res2: Int = 18
(dateInterval: any2stringadd[DateInterval]).+(other)
(dateInterval: Ordered[DateInterval]).<(that)
(dateInterval: Ordered[DateInterval]).<=(that)
(dateInterval: Ordered[DateInterval]).>(that)
(dateInterval: Ordered[DateInterval]).>=(that)
(dateInterval: Ordered[DateInterval]).compare(that)
(dateInterval: Ordered[DateInterval]).compareTo(that)
Base class for specific date intervals +
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
Utility class for working with HDFS URLs.
It allows to customize how dates are formatted and then
scala> HdfsUrl("some/path") / "somewhere" / Day(2016, 8, 28) +res1: HdfsUrl = some/path/somewhere/2016-08-28 +scala> HdfsUrl("root", dateFormat = Some("'year='yyyy/'month'=MM")) / Day(2016, 8, 28) +res2: HdfsUrl = root/year=2016/month=08
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
Quarters of the year.
scala> Quarter(2017, Quarter.Q1) +res1: DateInterval = 2017-Q1 +scala> Year(2017).by(Quarter).toList +res2: List[DateInterval] = List(2017-Q1, 2017-Q2, 2017-Q3, 2017-Q4) +scala> Quarter(2017, Quarter.Q1).by(Month).toList +res3: List[DateInterval] = List(2017-01, 2017-02, 2017-03) +scala> Quarter.parse("2008-Q4") +res4: Option[DateInterval] = Some(2008-Q4) +scala> Quarter(2017, Quarter.Q2).format("yyyy-MM-dd") +res5: String = 2017-04-01
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
A schedule is a sequence of monotonic decreasing dates. It can be +composed with other schedules to form more complex execution plans.
Generating a list of days for a daily schedule:
scala> Schedule.iterate(Day(2016, 7, 2)).take(3).toList +res2: List[DateInterval] = List(2016-07-02, 2016-07-01, 2016-06-30)
Generate a list of days for a monthly schedule:
scala> Schedule.iterate(Month(2016, 3)).where(Year(2016).<=).toList +res1: List[DateInterval] = List(2016-03, 2016-02, 2016-01)
Combine two date streams.
+(Changed in version 2.9.0) The behavior of scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
(Changed in version 2.9.0) transpose
throws an IllegalArgumentException
if collections are not uniformly sized.
Only includes dates newer than a given date.
+(schedule: MonadOps[DateInterval]).filter(p)
(schedule: MonadOps[DateInterval]).flatMap(f)
(schedule: MonadOps[DateInterval]).map(f)
(schedule: MonadOps[DateInterval]).withFilter(p)
Mixin providing a DSL for defining schedules.
If for example, we want to run a report against a cumulative data source +each day and must ensure that it runs the first of every month to generate +a report for all of the previous month. This schedule can be defined as:
val schedule = today and monthly
If we are only interested in "backfilling" jobs from a specific date use
+a where
clause, e.g.:
val schedule = daily where (_ >= Date(2016, 4, 12)
Marker trait for case classes to automatically provide a Spark +encoder. +
(Since version 2.11.0) Use Throwable#getStackTrace
Wrap the functionality to send messages to a Slack channel. +
Post the given message to a Slack channel.
Post the given message to a Slack channel. +
the text of the message to send.
optional icon for the message.
com.mediative.amadou.SparkImplicits
+Filter out values which are null, empty or "null".
Filter out values which are null, empty or "null". +
dataset.filter($"UserId".isDefined)
Replace "null" string with NULL value.
Replace "null" string with NULL value. +
dataset.filter($"Description".nullify)
Helpers for working with Dataset columns.
+Maximum number of dates considered from a schedule.
+A Spark ETL job
Jobs have a schedule of dates which is filtered using job specific +logic and run in chronological order. For example, for jobs which run +each day and at end of month, we check if it ran correctly "today" +and if not we traverse if it ran for previous "month's end" etc., +until we find a completed run or we have traversed some magical max +number.
The schedule can be overridden by defining the start
environment
+variable with a date formatted as "yyyy-MM-dd". In this case the job
+is only run the the specified date.
+
Base class which provides an environment for running tasks. +
Counters will be reset before each job run.
Counters will be reset before each job run. +
Value reader for optionally loading properties from a file.
Value reader for optionally loading properties from a file.
When the named path does not exists an empty Properties instance is returned +
case class Database(url: String, properties: Properties)
(Since version 2.11.0) Use Throwable#getStackTrace
Combine multiple stages into a single stage which fails if any of them results +in a failure.
+Read data from a data source.
Read data from a data source.
May be used anywhere in a for-expression to read from a data source. +
ISO 8601 week. Note that it has some counterintuitive behavior around new year. +For instance Monday 29 December 2008 is week 2009-W01, and Sunday 3 January 2010 is week 2009-W53-7 +This example was taken from from http://en.wikipedia.org/wiki/ISO_8601#Week_dates:
scala> Week(Day(2008, 12, 29)) +res1: DateInterval = 2009-W01 +scala> Week(Day(2010, 1, 3)) +res2: DateInterval = 2009-W53 +scala> Week(2009, 53, dayOfWeek = Week.Sunday).by(Day).last +res3: DateInterval = 2010-01-03
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
Represent the interval for a given timestamp using the specified +interval type.
Represent the interval for a given timestamp using the specified +interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1.
Example:
scala> Day(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res1: String = 2015-05-07 00:00 +0000 +scala> Month(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-01 00:00 +0000 +scala> Year(1431000000000L).format("yyyy-MM-dd HH:mm ZZ") +res3: String = 2015-01-01 00:00 +0000
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Create a date interval with a different type and truncate lower +resolution date fields accordingly.
Example:
scala> Day(1431000000000L) +res1: DateInterval = 2015-05-07 +scala> Week(Day(1431000000000L)) +res2: DateInterval = 2015-W19 +scala> Month(Day(1431000000000L)) +res3: DateInterval = 2015-05 +scala> Quarter(1431000000000L) +res4: DateInterval = 2015-Q2 +scala> Year(Day(1431000000000L)) +res5: DateInterval = 2015 +scala> Year(Day(1431000000000L)).format("yyyy-MM-dd HH:mm ZZ") +res6: String = 2015-01-01 00:00 +0000
Parse a timestamp into a date interval.
Parse a timestamp into a date interval.
Example:
scala> Day.parse("2015-05-07") +res1: Option[DateInterval] = Some(2015-05-07) +scala> Day.parse("2015-05-07").get.format("yyyy-MM-dd HH:mm ZZ") +res2: String = 2015-05-07 00:00 +0000
Represent the interval for today using the specified interval type.
Represent the interval for today using the specified interval type.
This will truncate lower resolution date fields to their initial +value, for example for months the day of month field is set to 1. +
com.mediative.amadou.bigquery.BigQueryTable
+Holds information about how to load data into BigQuery.
Example:
scala> val date = com.mediative.amadou.Day(2016, 9, 7) +scala> val table = BigQueryTable("company_bi", "finance", "billing") +scala> table.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing} +scala> table.partitionedByDay.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing20160907} +scala> table.partitionedByMonth.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing20160901}
com.mediative.amadou.bigquery.GoogleAuthentication
+com.mediative.amadou.bigquery.GoogleAuthentication
+Save a DataFrame to a BigQuery table.
+Enhanced version of SparkSession with BigQuery support. +
Reads a CSV extract of a BigQuery table.
+Set BigQuery dataset location, e.g.
Set BigQuery dataset location, e.g. US, EU. +
Set GCS bucket for temporary BigQuery files.
+Set GCP project ID for BigQuery.
+Set GCP JSON key file.
+Set GCP pk12 key file.
+Enhanced version of DataFrame with BigQuery support.
+Enhanced version of SparkSession with BigQuery support.
+Holds information about how to load data into BigQuery.
Holds information about how to load data into BigQuery.
Example:
scala> val date = com.mediative.amadou.Day(2016, 9, 7) +scala> val table = BigQueryTable("company_bi", "finance", "billing") +scala> table.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing} +scala> table.partitionedByDay.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing20160907} +scala> table.partitionedByMonth.referenceFor(date) +res1: BigQueryTable.Reference = {datasetId=finance, projectId=company_bi, tableId=billing20160901}
com.mediative.amadou.monitoring
+com.mediative.amadou.monitoring
+com.mediative.amadou.monitoring.MessagingSystem
+com.mediative.amadou.monitoring
+com.mediative.amadou.monitoring
+com.mediative.amadou.monitoring
+Process and stage states registry. +
Process and stage states registry.
+Mixin for loading and injecting values from configuration files.
+Base class for date intervals.
Base class for date intervals.
The interval is represented as the half open range between from
and to
.
+For instance, May 2014 is represented as from = 2014-05-01
, to = 2014-06-01
.
Example:
scala> Seq(Day(2016, 8, 11), Week(2016, 32), Month(2016, 8), Quarter(2016, Quarter.Q3), Year(2016)) +res1: Seq[DateInterval] = List(2016-08-11, 2016-W32, 2016-08, 2016-Q3, 2016)
Base class for specific date intervals +
+Utility class for working with HDFS URLs.
Utility class for working with HDFS URLs.
It allows to customize how dates are formatted and then
scala> HdfsUrl("some/path") / "somewhere" / Day(2016, 8, 28) +res1: HdfsUrl = some/path/somewhere/2016-08-28 +scala> HdfsUrl("root", dateFormat = Some("'year='yyyy/'month'=MM")) / Day(2016, 8, 28) +res2: HdfsUrl = root/year=2016/month=08
Manage auto closeable resources.
+A schedule is a sequence of monotonic decreasing dates.
A schedule is a sequence of monotonic decreasing dates. It can be +composed with other schedules to form more complex execution plans.
Generating a list of days for a daily schedule:
scala> Schedule.iterate(Day(2016, 7, 2)).take(3).toList +res2: List[DateInterval] = List(2016-07-02, 2016-07-01, 2016-06-30)
Generate a list of days for a monthly schedule:
scala> Schedule.iterate(Month(2016, 3)).where(Year(2016).<=).toList +res1: List[DateInterval] = List(2016-03, 2016-02, 2016-01)
Mixin providing a DSL for defining schedules.
Mixin providing a DSL for defining schedules.
If for example, we want to run a report against a cumulative data source +each day and must ensure that it runs the first of every month to generate +a report for all of the previous month. This schedule can be defined as:
val schedule = today and monthly
If we are only interested in "backfilling" jobs from a specific date use
+a where
clause, e.g.:
val schedule = daily where (_ >= Date(2016, 4, 12)
Wrap the functionality to send messages to a Slack channel.
+A Spark ETL job
A Spark ETL job
Jobs have a schedule of dates which is filtered using job specific +logic and run in chronological order. For example, for jobs which run +each day and at end of month, we check if it ran correctly "today" +and if not we traverse if it ran for previous "month's end" etc., +until we find a completed run or we have traversed some magical max +number.
The schedule can be overridden by defining the start
environment
+variable with a date formatted as "yyyy-MM-dd". In this case the job
+is only run the the specified date.
+
Base class which provides an environment for running tasks.
+Quarters of the year.
Quarters of the year.
scala> Quarter(2017, Quarter.Q1) +res1: DateInterval = 2017-Q1 +scala> Year(2017).by(Quarter).toList +res2: List[DateInterval] = List(2017-Q1, 2017-Q2, 2017-Q3, 2017-Q4) +scala> Quarter(2017, Quarter.Q1).by(Month).toList +res3: List[DateInterval] = List(2017-01, 2017-02, 2017-03) +scala> Quarter.parse("2008-Q4") +res4: Option[DateInterval] = Some(2008-Q4) +scala> Quarter(2017, Quarter.Q2).format("yyyy-MM-dd") +res5: String = 2017-04-01
Marker trait for case classes to automatically provide a Spark +encoder.
+ISO 8601 week.
ISO 8601 week. Note that it has some counterintuitive behavior around new year. +For instance Monday 29 December 2008 is week 2009-W01, and Sunday 3 January 2010 is week 2009-W53-7 +This example was taken from from http://en.wikipedia.org/wiki/ISO_8601#Week_dates:
scala> Week(Day(2008, 12, 29)) +res1: DateInterval = 2009-W01 +scala> Week(Day(2010, 1, 3)) +res2: DateInterval = 2009-W53 +scala> Week(2009, 53, dayOfWeek = Week.Sunday).by(Day).last +res3: DateInterval = 2010-01-03
t |
Mixin for loading and injecting values from configuration files. +