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

autocompletion with database and tables not working #2

Open
kylegrieder opened this issue Jan 12, 2018 · 5 comments
Open

autocompletion with database and tables not working #2

kylegrieder opened this issue Jan 12, 2018 · 5 comments

Comments

@kylegrieder
Copy link

I can't get databases or tables to load, which means autocompletion for fields isn't working either.

I'm able to connect and run queries, but when I click the "Database" drop down in the connection window, nothing appears. Any idea what the problem might be?

@mrn3
Copy link
Owner

mrn3 commented Jan 12, 2018

yeah, this might not be in a totally workable state. it might work for mysql, but not so much for postgresql, or vice versa. I haven't actively been working on this for a while, so I am not sure I can help much more, but if you want to help dig into the code, I think we can resolve your issue.

@kylegrieder
Copy link
Author

kylegrieder commented Jan 12, 2018 via email

@mrn3
Copy link
Owner

mrn3 commented Jan 12, 2018

Okay, yeah, I used it with Redshift too, but I hadn't sorted everything out. It is tricky because Redshift/Postgres has databases, schemas, and tables, but MySQL only has databases and tables, so there is another level of hierarchy with Redshift.

@kylegrieder
Copy link
Author

kylegrieder commented Jan 12, 2018

I found an issue, but I'm not sure how to solve it completely.

In lib\data-managers\redshift-manager.js, in getDatabaseNames(), there is an if statement in place for building the query to retrieve databases. It seems to have something to do with being a super-user for the database. I removed the if statement and simply replaced the whole thing with

let query = 'SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname;'

I realize its not ideal, but for my purposes it seems to work. Now, when connecting via the New Connection modal, databases are retrieved and when I select a database, the various schemas are retrieved.

This is where I'm running into trouble though. Autocomplete still isn't working, and I noticed that it seems like there should be a tree view of the associated tables and columns once a schema is selected, but that doesn't show up either. I looked at lib\views\details-view.js, at the buildTableList() function. I noticed on line 97 that you're calling this.DBManager.getTables(database), however in redshift-manager.js, the getTables() function expects 2 parameters - database, and schemaName. I believe this might be why tables aren't being retrieved, and therefore no table tree view is appearing.

This is where I kind of got lost. I'm also at work right now and can't spend any more time on it, but I wanted to update you on what I found so far. I'm not super familiar with javascript, and I'm only a junior developer anyway, so I'm not sure it would be an efficient use of my time to delve into this further, at least not while I'm working.

I'll continue to look at it sometime tonight when I get home, but I wanted to update you on my progress. Thanks for your time.

@mrn3
Copy link
Owner

mrn3 commented Jan 12, 2018

yeah, thanks for looking into that. this sounds like the issues I was trying to fix with the hierarchy being different on postgres/redshift than mysql. I ended up mostly abandoning the project as I have moved on and don't really use this anymore. So, I am not sure I will actively be fixing this issue, but if you want to take over the project or just do a pull request to fix this, I am open to it.

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

No branches or pull requests

2 participants