-
Notifications
You must be signed in to change notification settings - Fork 610
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
FEAT: Added load_data to sqlalchemy's backend #1981
Conversation
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.
thanks for the review @ian-r-rose
efb199d
to
71c7b32
Compare
83ce743
to
70c3769
Compare
this PR is ready for review. thanks! |
b64fd20
to
f7a2e2a
Compare
CI is green now. |
docs/source/release.rst
Outdated
@@ -15,6 +15,7 @@ Release Notes | |||
* :feature:`2060` Add initial support for ibis.random function | |||
* :support:`2107` Added fragment_size to table creation for OmniSciDB | |||
* :feature:`2117` Add non-nullable info to schema output | |||
* :feature:`1981` Add load_data to sqlalchemy's backends |
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.
actually can you add an entry for the postrgres bug fix, ping on green.
f7a2e2a
to
e116d4a
Compare
@jreback CI is green. thanks! |
@jreback a gentle reminder about this PR :) |
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.
pls
really really try to do one change per PR
missing things makes reviews 10x harder and will take much longer
ci/docker-compose.yml
Outdated
@@ -10,7 +10,7 @@ services: | |||
POSTGRES_PASSWORD: '' | |||
|
|||
mysql: | |||
image: mariadb:10.2 | |||
image: mariadb:10.4.12 |
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.
do we actually need this new? iow are we now not supporting an older version?
generally we should not touch anything in the CI except for a dedicated PR
this way we don’t regress
also we want to test oldest versions that are supported and not newest
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.
Sorry, I forgot to mention about this change.
MariaDB had an issue that you can check it here: MariaDB/mariadb-docker#262 (comment)
so as I was running tests locally that hit some issue due MYSQL_INITDB_SKIP_TZINFO
I needed to change that.
I can open a separated PR for that if you want.
ibis/impala/client.py
Outdated
@@ -516,7 +516,7 @@ def insert( | |||
) | |||
return self._execute(statement) | |||
|
|||
def load_data(self, path, overwrite=False, partition=None): | |||
def load_data(self, path, overwrite=False, partition=None, **kwargs): |
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.
why do we need kwargs? generally we want to explicitly list all parameters if possible
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.
as I am adding a test for all backends .. it simplified the test. but I can add specific arguments for each backend.
@@ -1099,6 +1100,10 @@ def begin(self): | |||
|
|||
@invalidates_reflection_cache | |||
def create_table(self, name, expr=None, schema=None, database=None): | |||
# reset database if it is the same one used by the connection | |||
if database == self.database_name: |
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.
why is this needed?
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 hit #1979 testing load_data method locally. Just reseting the database variable when it is the same as sef.database_name fixed the issue.
another way to fix that maybe would be replace self.engine.url.database
by self.database_name
|
||
Raises | ||
------ | ||
NotImplementedError |
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.
huh?
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.
it is related to this:
raise NotImplementedError(
'Loading data to a table from a different database is not '
'yet implemented'
)
probably the original message is much better. I will use that for the documentation.
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.
thanks @jreback for the review. I will apply your suggestion.
sorry if sometimes it looks a big PR .. but as sometimes it touches more than 1 issue for one specific testing I am doing locally .. so it is hard to keep it in different PRs
ci/docker-compose.yml
Outdated
@@ -10,7 +10,7 @@ services: | |||
POSTGRES_PASSWORD: '' | |||
|
|||
mysql: | |||
image: mariadb:10.2 | |||
image: mariadb:10.4.12 |
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.
Sorry, I forgot to mention about this change.
MariaDB had an issue that you can check it here: MariaDB/mariadb-docker#262 (comment)
so as I was running tests locally that hit some issue due MYSQL_INITDB_SKIP_TZINFO
I needed to change that.
I can open a separated PR for that if you want.
@@ -1099,6 +1100,10 @@ def begin(self): | |||
|
|||
@invalidates_reflection_cache | |||
def create_table(self, name, expr=None, schema=None, database=None): | |||
# reset database if it is the same one used by the connection | |||
if database == self.database_name: |
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 hit #1979 testing load_data method locally. Just reseting the database variable when it is the same as sef.database_name fixed the issue.
another way to fix that maybe would be replace self.engine.url.database
by self.database_name
|
||
Raises | ||
------ | ||
NotImplementedError |
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.
it is related to this:
raise NotImplementedError(
'Loading data to a table from a different database is not '
'yet implemented'
)
probably the original message is much better. I will use that for the documentation.
ibis/impala/client.py
Outdated
@@ -516,7 +516,7 @@ def insert( | |||
) | |||
return self._execute(statement) | |||
|
|||
def load_data(self, path, overwrite=False, partition=None): | |||
def load_data(self, path, overwrite=False, partition=None, **kwargs): |
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.
as I am adding a test for all backends .. it simplified the test. but I can add specific arguments for each backend.
ba5f2a3
to
0f22a66
Compare
2d4619d
to
66b1f77
Compare
this PR is ready again for a new review. thanks! |
thanks @xmnlab |
In this PR:
has_attachment
toAlchemyClient
, useful for some operations that need to useschema
when database attachment is used, for exampleto_sql
.