-
Notifications
You must be signed in to change notification settings - Fork 168
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
SQLAlchemy support #81
Conversation
80b334f
to
f44da94
Compare
Let me know when this becomes non-draft. |
@findepi Do you know why CI say |
@dungdm93 Could it be due to https://github.com/trinodb/trino-python-client/blob/16feda14efb1a0985053d92338313f32548d1095/trino/__init__.py (no trino.sqlalchemy entry there). cc: @joshthoward |
this shouldn't be needed. i just merged #83 so that you can drop this one |
bfdfc05
to
f448713
Compare
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 for the delay in reviewing. Thanks a lot for your work.
A few comments.
I did not review feat: TrinoTypeCompiper datatypes yet.
Also, I did not completely understand datatype.py
added in 66f6666.
trino/sqlalchemy/dialect.py
Outdated
else: | ||
raise ValueError(f'Unexpected database format {url.database}') | ||
|
||
username = kwargs.pop('username', 'anonymous') |
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 provide a default username? The default for all other clients is an empty/missing username.
Also you can inline this into the line below.
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.
If username is empty, we get this error:
trino.exceptions.HttpError: error 401: b'Basic authentication or X-Trino-User must be sent'
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.
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.
@ebyhr is that implemented any where else (like CLI or JDBC)?
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.
@ebyhr @dungdm93 yes, we should default to os username, as CLI does, or require username to be set.
JDBC requires user
to be set: https://github.com/trinodb/trino/blob/ceb2d1b8238c4b6949abf2e7f506aab83bf1ea02/client/trino-jdbc/src/main/java/io/trino/jdbc/ConnectionProperties.java#L157
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.
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.
So now user
is required.
This must be specify either in URL or in connect_args
engine = create_engine("trino://username@localhost:8080/mysql")
# or
engine = create_engine(
"trino://localhost:8080/mysql",
connect_args=dict(user="username")
)
@dungdm93 Did you get a chance to address the comments? I would really love to see this merged. Let me know if there's anything I can help with to push this over the finish line. |
Sorry @hashhar to let you waiting. I so busy recently. I’ll try to finish this task next week. |
@dungdm93 Did you have time to add the comments? I can help and create another PR from this one if you're busy, please let me know in that case. |
ff00675
to
0ad3563
Compare
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.
3rd commit: "test: dialect.create_connect_args"
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.
4th commit: "refactor: change IsolationLevel to Enum"
Can we extract the formatting related changes to a separate first commit? It makes it much easier to see the places where actual changes have happenned.
A few comments. I'll do an in-depth review once again after reading up about the sqlalchemy api expectations.
a61c292
to
8bb13b7
Compare
beff693
to
60c27d1
Compare
9c7c8cd
to
0ad84e8
Compare
6e09a05
to
5ff9a27
Compare
5ff9a27
to
0958642
Compare
How is the current state of the port? Is it mostly usable? |
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.
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.
Looks mostly good to me. Couple of comments.
@findepi Do you want to take a look?
Also, I can't see any way to logically keep the commits separate - please squash them into a single one. |
Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
@hashhar updated as your comments. |
Merged as da1441f (and preceding commits). There were some conflicts that I resolved (and split into commits). Your authorship is retained on all commits. Thanks so much for continuing to work on this @dungdm93 and getting it merged. ❤️ This will be available in the next release which should follow soon. |
See #13