New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle salesforce objects with camelcase names correctly #238
Conversation
@@ -6,8 +6,14 @@ import com.gu.sf_datalake_export.salesforce_bulk_api.BulkApiParams.ObjectName | |||
import com.gu.util.config.Stage | |||
|
|||
object ExportS3Path { | |||
|
|||
def camelToHyphenCase(camelCaseString: String): String = { | |||
val beforeUpperCase = "(?=[A-Z])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of regular expressions but I could not find a better way to do this. This matches a zero length space before an upper case letter so when we split using it the upper case letter is not removed from the resulting parts.
Also, this simple conversion is good enough for all our salesforce object names defined in: https://github.com/guardian/zuora-auto-cancel/blob/master/handlers/sf-datalake-export/src/main/scala/com/gu/sf_datalake_export/salesforce_bulk_api/SfQueries.scala#L18
but would fail for strings with multiple upperCase letters in a row like "AmazonSQSClient"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's OK. For example we use Card_Expiry not CC_Expiry.
Pull Request Test Coverage Report for Build 796
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
When doing the CardExpiry salesforce export I realised we are not generating the correct bucket names for the export if the name of the salesforce object is in camelcase.
The convention for ophan data lake buckets is to use hyphen case so instead of :
ophan-raw-salesforce-cardExpiry
we should be writing to
ophan-raw-salesforce-card-expiry