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
Refactoring: getting tables columns #10
Conversation
změnil jsem postup pro načítání názvů sloupečků a dat:
|
@@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | |||
&& /tmp/composer-install.sh | |||
|
|||
# Install and configure the C implementation of Protobuf extension if needed. | |||
RUN pecl install protobuf; echo 'extension=protobuf.so' >> $PHP_INI_DIR/conf.d/protobuf.ini; | |||
RUN pecl install protobuf-3.19.4; echo 'extension=protobuf.so' >> $PHP_INI_DIR/conf.d/protobuf.ini; |
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.
je nová verze protobuf
která ale nefunguje
protocolbuffers/protobuf#9724
private const USER_TABLES_STRUCTURE = [ | ||
self::CUSTOMER_TABLE => [ | ||
'primaryKeys' => ['id'], | ||
'columns' => [ |
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.
columns už nepotřebuju - stahuju z query
$csvCustomer = new CsvWriter(sprintf('%s/out/tables/%s.csv', $this->dataDir, self::CUSTOMER_TABLE)); | ||
$csvCampaign = new CsvWriter(sprintf('%s/out/tables/%s.csv', $this->dataDir, self::CAMPAIGN_TABLE)); |
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.
přesunuto do vlastních metod customers/campaigns
@@ -120,47 +82,9 @@ public function extract(): void | |||
)); | |||
} | |||
} | |||
|
|||
// Create manifest for Customer |
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.
přesunuto do vlastních metod customers/campaigns
$columnData = $data; | ||
foreach (explode('.', $columnKey) as $key) { | ||
if (!array_key_exists($key, $columnData)) { | ||
$output[$columnName] = null; |
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.
data pro sloupeček neexistují => null
$column = implode('.', $column); | ||
} | ||
$columnKey = lcfirst(str_replace('_', '', ucwords($column, '_'))); | ||
$columnValue = lcfirst(str_replace(['.', '_'], '', ucwords($column, '._'))); |
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.
musíme nahradit customer.time_zone
za customerTimeZone
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.
LGTM
Na ten mechanizmus nahradzovania chybajuceho stlpca s null
by sa hodil nejaky unit test.
Tj, vstup s vynechanymi stlpcami, a v nahodnom poradi -> no spravny vystup.
3964280
to
13c61b0
Compare
https://keboola.zendesk.com/agent/tickets/22081
https://keboola.zendesk.com/agent/tickets/21918