Skip to content
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

7) Fix getTables request #75

Merged
merged 14 commits into from
Jan 4, 2019
Merged

7) Fix getTables request #75

merged 14 commits into from
Jan 4, 2019

Conversation

pivnicek
Copy link
Contributor

@pivnicek pivnicek commented Nov 8, 2018

Fixes #72

Rebased onto #71

@pivnicek pivnicek changed the title Fix getTables request 7) Fix getTables request Nov 8, 2018
@pivnicek pivnicek requested a review from Halama November 9, 2018 09:43
@Halama
Copy link
Member

Halama commented Nov 19, 2018

I've rebased it

Copy link
Member

@Halama Halama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this. It was really hard to figure out if this fixes the issue. There are some suggestions below. The testing of fixed behavoir should be here.

tests/SnowflakeTest.php Show resolved Hide resolved
$tableDefs = [];
foreach ($arr as $table) {
if ($this->shouldTableBeSkipped($table)) {
continue;
}
if (is_null($tables) || !(array_search($table['name'], array_column($tables, 'tableName')) === false)) {
$tableNameArray[] = $table['name'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still a little bit lost in a logic of this function. I think it would be more clear to:

    1. fetch array of all tables with it schema associated which should be fetched. It is $tableDefs array now.
    1. fetch columns for all tables from $tableDefs. So the SQL would look like:

SELECT * FROM information_schema.columns WHERE
(table_schema = 'snowflake_extractor' AND table_name = 'LARGE') 
OR
(table_schema = 'snowflake_extractor' AND table_name = 'LARGE_100M')
;

So than you can be sure that really only columns for requested tables are fetched and there is less conditions.

@pivnicek
Copy link
Contributor Author

@Halama , sorry I let this slip, I've updated it and think it's now more clear.

@pivnicek
Copy link
Contributor Author

pivnicek commented Jan 3, 2019

@Halama az budes mit kvilicku muzes na tohle dat oko? rad bych ho releasnout.

@Halama
Copy link
Member

Halama commented Jan 3, 2019

@pivnicek I am not sure when I'll get to this:( Maybe try someone other for review?

@pivnicek
Copy link
Contributor Author

pivnicek commented Jan 3, 2019

@Halama sure, no worries

@@ -17,7 +17,7 @@
"keboola/php-csv-db-import": "~2.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.6.*",
"phpunit/phpunit": "^7.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the upgrade? And why not upgrade anything else (cs, phpstan)? I have to say I much prefer to create separate PR for any non-related changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must have been a reason, I think to match with the common-lib version, but you're right, should have been better done somewhere else. Shall I move it, or can we keep it just this once ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Keep it :)

tests/SnowflakeTest.php Outdated Show resolved Hide resolved
tests/AbstractSnowflakeTest.php Outdated Show resolved Hide resolved
@pivnicek
Copy link
Contributor Author

pivnicek commented Jan 4, 2019

Thanks @tomasfejfar ! I've updated it.

@pivnicek
Copy link
Contributor Author

pivnicek commented Jan 4, 2019

ok, I'm going to merge this then 🎉

@pivnicek pivnicek merged commit 659e8ad into master Jan 4, 2019
@pivnicek pivnicek deleted the piv-fix-gettables branch January 4, 2019 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants