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

[Trino] Table/database names starting with digit should inclosed with double quotes #3735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

agl29
Copy link
Collaborator

@agl29 agl29 commented May 13, 2024

What changes were proposed in this pull request?

  • Table/database names starting with digit were giving syntax error.
  • Added the double quotes for catalog, database and tables

How was this patch tested?

  • Locally

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -90,21 +87,24 @@ def get_auth_password(self):
else DEFAULT_AUTH_PASSWORD.get()
)

def _format_database(self, database):
parts = database.split('.')
database = '"' + '"."'.join(parts) + '"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we make sure only formats it once? I.e. not if it's already formatted..

def _get_select_query(self, database, table, column=None, operation=None, limit=100):
if operation == 'hello':
statement = "SELECT 'Hello World!'"
else:
column = '%(column)s' % {'column': column} if column else '*'
database = self._format_database(database)
column = '"%(column)s"' % {'column': column} if column else '*'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same.

statement = textwrap.dedent('''\
SELECT %(column)s
FROM %(database)s.%(table)s
FROM %(database)s."%(table)s"
Copy link
Contributor

Choose a reason for hiding this comment

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

And here.

import time
import logging
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems not using anywhere in the file

@@ -47,7 +45,7 @@ def decorator(*args, **kwargs):
except RestException as e:
try:
message = force_unicode(json.loads(e.message)['errors'])
except:
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this change the character to not shadowed by the previous exception, like Exception as ex?

Copy link

github-actions bot commented Aug 5, 2024

This PR is stale because it has been open 45 days with no activity and is not labeled "Prevent stale". Remove "stale" label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Aug 5, 2024
@agl29 agl29 removed the Stale label Aug 5, 2024
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.

4 participants