-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add table settings support #22
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.
Almost done 🦕
@@ -343,7 +343,35 @@ def get_bind_types( | |||
|
|||
|
|||
class YqlDDLCompiler(DDLCompiler): | |||
pass | |||
def post_create_table(self, 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.
nitpick (blocking): Could you provide a typehint here?
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.
fixed
pass | ||
def post_create_table(self, table): | ||
ydb_opts = table.dialect_options["ydb"] | ||
with_content = [] |
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.
nitpick (non-blocking) Usually in the compilers such variables are named "_clause". Up to you
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.
renamed
@@ -343,7 +343,35 @@ def get_bind_types( | |||
|
|||
|
|||
class YqlDDLCompiler(DDLCompiler): | |||
pass | |||
def post_create_table(self, 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.
suggestion (blocking) There are another table settings, for example, TTL, which may be rendered in the WITH clause. I suggest to move this code to the def render_table_partitioning_settings(self, table) -> List[str]
and add call of the method to the post_create_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.
fixed
Looks good for me, let's remove "WIP" prefix |
) | ||
table.create(connection) | ||
|
||
session: ydb.Session = connection.connection.driver_connection.pool.acquire() |
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.
nitpick: We have to return this session to the pool at the end, but it's not crucial in tests I think
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 can be problem in tests too - pool has limited sessions (default 100), if the limit will be reached - code can't get new session.
It is not big problem in one place, but it will be problem in loops or if many tests will not return the session.
especially if reuse connection (and session pool) between tests.
It is better to fix it
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.
Added calling of delete()
method for session
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.
Hello @ilchuk96
Thanks for the work!
Can you fix the session leak?
And what about use protobuf constants instead of hardcoded calues (1,2) in tests?
) | ||
table.create(connection) | ||
|
||
session: ydb.Session = connection.connection.driver_connection.pool.acquire() |
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 can be problem in tests too - pool has limited sessions (default 100), if the limit will be reached - code can't get new session.
It is not big problem in one place, but it will be problem in loops or if many tests will not return the session.
especially if reuse connection (and session pool) between tests.
It is better to fix it
test/test_core.py
Outdated
@pytest.mark.parametrize( | ||
"auto_partitioning_by_size,res", | ||
[ | ||
(None, 1), |
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.
Here and below:
What about import protobuf to tests and re-use constants from protobuf?
instead of hard-code int values?
import protobuf is bad for public interface, but so-ok for tests and better (by my opinion) then hard-codede values.
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.
Did I add it correctly?
from ydb._grpc.v4.protos import ydb_common_pb2
<...>
ydb_common_pb2.FeatureFlag.Status.ENABLED
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 work
No description provided.