Giter Club home page Giter Club logo

sublime-sqlexec's People

Contributors

bosborne avatar gl3n avatar julio73 avatar maik93 avatar mverrilli avatar rogenaro avatar tgirardi avatar tkopets avatar xpavp03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublime-sqlexec's Issues

: 'Window' object has no attribute 'create_output_panel'

I installed the plugin sublime-sqlexec followed the steps as in the official site and executed the query but it doesn't show the output.And after that i opened my console window it showed
AttributeError: 'Window' object has no attribute 'create_output_panel'
I am using sublime text2 in windows7.Please help me to fix this issue.Any help would be appreciated

Missing password gives KeyError for pg

I don't use a password for my local postgresql database so I didn't specify the password property for my connection. This worked so so.. This is what the console gives me when I try to List connections:

Traceback (most recent call last):
  File "SQLExec in /Users/jacob/Library/Application Support/Sublime Text 3/Installed Packages/SQLExec.sublime-package", line 140, in sqlChangeConnection
  File "SQLExec in /Users/jacob/Library/Application Support/Sublime Text 3/Installed Packages/SQLExec.sublime-package", line 120, in __init__
KeyError: 'password'

Just adding "password": "" fixes it but I thought this might be worth mentioning.

Please add "show_result_on_window" option to Wiki docs

Superb package. I was looking at your code trying to figure out how I might modify it to get output in a new window and found that the option was already there!

Can you add this "hidden" setting to your Wiki? Thanks again.

SSH tunnels ??

Hello,

Just installed the plugin and it's pretty awesome.
We, however, have our production DB in the cloud and it's not directly accessible from localhost.

Would you support the addition of this feature? See here, for instance.

Oracle Connection Errors

Using this setup:

{
        "show_result_on_window": true,
        "connections": {
         "MyDbNickname": {
             "type"    : "oracle",
             "host"    : "db.company.com",
             "port"    :  1585,
             "username": "myusername",
             "password": "mypassword",
             "database": "tnsname",
             "service" : "tnsname"
         }
     }
 }

I always get the same error of

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
SP2-0306: Invalid option.

which makes me wonder if the connection string is being passed incorrectly or if I'm just setting it up incorrectly?

My $PATH is set correctly, as a string of

sqlplus myusername/mypassword@tnsname

works just fine from the command line, and other sql apps find the tnsnames.ora file just fine.

Allow to avoid passing the password through the command arguments

Passing the password as a command argument can lead to security issues (even MySQL throws a warning when you do it).

One solution could be to allow the user to set a particular string for the arguments (sql_exec.args), so the user can delete the -p parameter and rely on a ".my.cnf" file to store the password in it.

Is it possible to do that on the current version? Does it sound like a good idea?

'before' can not be changed

Hi,

I find this plug in amazing, it helps me everyday and make my life beautiful (not sarcasm). Working on Oracle, I prefer work on sublime Text.

I would like to set the "before" of my database without editing the plugin (sgbd/oracle.sqlexec) itself to put my "output parameters". like :

SET LONG          100
SET PAGESIZE      0 EMBEDDED ON
SET HEADING       ON
...

I send that cause, you just published an update and I lost all my parameters.
I love updates so don't worry ;-)

Thank you ! <3

Error /bin/sh: psql: command not found

Hi guys,

I installed sqlexec but get the error "/bin/sh: psql: command not found" upon executing a query from sublime 3.
I have the psql binary stored under

"/Applications/Postgres.app/Contents/Versions/9.3/bin/psql"

I also have them symlinked under /usr/local/bin.

Upon running "sh" from the terminal and checking out the PATH variable, I get the following which contains the directory where all the psql binaries are

sh-3.2$ echo $PATH /usr/local/heroku/bin:/Library/Ruby/Gems/2.0.0/cache:/Users/nitin/bin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Thanks

psql multi-line on Sublime breaks

Hi,

Thanks for making this awesome plugin. While it works very well when I inline my entire psql query, I do get an error if I split even the simplest query such as the one down below into multiple lines

select count(*)
from mytable
ERROR:  syntax error at or near "from"
LINE 1: from mytable
-- This will work though
select count(*) from mytable

This naturally limits the ability to perform complex queries. Let me know if you are aware of this issue and if I can help fix it. Thanks

wrong encoding in message window

After expression are executed, the message window contains symbols in wrong encoding. i guess it's possible to check whether is good encoding for a computer or add an option to change it, thank you

dont show error in a query

when i write a wrong sql query dont show me the error, just show me the query, i installed by package control :S

Focus the output panel with keyboard shortcut

First of all, great plugin!! :)

Second, the output gets displayed in some kind of "panel", I'm guessing by this code:

class Command:
    def __init__(self, text):
        self.text = text

    def _display(self, panelName, text):
        if not sublime.load_settings("SQLExec.sublime-settings").get('show_result_on_window'):
            panel = sublime.active_window().create_output_panel(panelName)
            sublime.active_window().run_command("show_panel", {"panel": "output." + panelName})
        else:
            panel = sublime.active_window().new_file()

        panel.set_read_only(False)
        panel.set_syntax_file('Packages/SQL/SQL.tmLanguage')
        panel.run_command('append', {'characters': text})
        panel.set_read_only(True)

Is there some way to focus this panel with a keyboard shortcut?
Sometimes when the output gets large I want to be able to scroll in it and maybe do a ctrl+f in some large Desc Table results.

Error trying to parse setting : Unexpected trailing character in Package

Hi,
I'm trying to configure sqlexec for Greenplum Database( A flavour of postgreSQL)

But Im getting below error
"Error trying to parse setting : Unexpected trailing character in Package"

Here is my configuration file

"sql_exec.commands":
{
"psql" : "/usr/local/greenplum-db/bin/psql"
}
{
"connections":
{
"Connection 1":
{
"type" : "psql",
"host" : "10.26.96.100",
"port" : 5432,
"username": "gpadmin",
"password": "changeme",
"database": "yogesh"
}
}
}

Cant find SQLExec in Package Control

Is there any other way to install SQLExec, I cant find it in package control. I am getting this error when I add it manually.

Error trying to parse file: Trailing comma before closing bracket in ~/Library/Application Support/Sublime Text 2/Packages/SQLExec/Default (OSX).sublime-keymap:8:1

default settings file has wrong name in sublime text 3

when i edit the default settings file from inside ST3 it opens "Base File.sublime-settings", but plugin looks for "SQLExec.sublime-settings". Renaming the file does the trick, but thet means you can edit settings from Preferences>Package Settings>SQLexec>Settings - Default

the issue seems to be here (sqlexec.py - line 128):

connections = sublime.load_settings("SQLExec.sublime-settings").get('connections')

Shell special characters on some settings will cause error

Some characters, that are considered as special characters by the shell, will produce an error when trying to execute the command, because they are not correctly escaped.

For example, if your password contains a '<' character, the command that will be issued to the shell will look something like this:

`mysql ... -Pmy<password ...``

That will make the shell look for the file named "password", in order to use it as input for the command.

I'll make a Pull Request in just a moment.

Suggestions

Hi,

  1. Add output if table has no rows. e.g. headers with no rows. Currently, nothing happens if the query has no results.
  2. In a multi query execution, add an index/name for each query executed. Or show the first X (e.g. 100) characters for each query. The idea is to make it easier to reference which set of results belong to which query when browsing the results.

Just suggestions. Thank you.

Project Dead?

I this project dead? There are outstanding pull requests and issues. If you don't have time, add me as a collaborator so I can do merges.

Otherwise, I'll be taking over the project under my own fork.

Error: 'Options' object has no attribute 'service' with oracle connection

I have configured plugin like that in user settings):

{
    "sql_exec.commands": {
        "oracle" : "sqlplus"
    }, 
    "connections": {
        "name": {
            "type": "oracle",
            "host": "hostnamee",
            "port": port_number,
            "username": "user",
            "password": "pass",
            "database": "sid",
            "service": "sid"
        }
    }
}

But when I try to run any query (select sysdate from dual;) I get this in output window:

Traceback (most recent call last):
  File "SQLExec in C:\[path]\Sublime Text 3\Installed Packages\SQLExec.sublime-package", line 172, in executeQuery
  File "SQLExec in C:\[path]\Sublime Text 3\Installed Packages\SQLExec.sublime-package", line 29, in execute
  File "SQLExec in C:\[path]\Sublime Text 3\Installed Packages\SQLExec.sublime-package", line 16, in _getCommand
  File "SQLExec in C:\[path]\Sublime Text 3\Installed Packages\SQLExec.sublime-package", line 13, in _buildCommand
AttributeError: 'Options' object has no attribute 'service'

Any help would be much appreciated!

Keep the sql session between two queries

In order to use temporary tables in PostgreSQL, is it possible to keep session between two queries in Sublime ?

Réf. : http://www.postgresql.org/docs/8.4/static/sql-createtable.html
TEMPORARY or TEMP
If specified, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction (see ON COMMIT below). Existing permanent tables with the same name are not visible to the current session while the temporary table exists, unless they are referenced with schema-qualified names. Any indexes created on a temporary table are automatically temporary as well.

Can it be an open source project?

Searching through the repository I cannot find any mention to open source licence. By this project being on Github, I am allowed to fork it by the Github TOS (Terms Of Service). However I am not allowed to create derivative works from it (pull requests). Meaning I cannot fork this repository, change its code and perform pull requests without the danger/liability of being prosecuted by violating the All rights reserved copyright granted by berne convention law.

The original prime theme for Sublime Text has the licence following open source licence:

The MIT License (MIT)

Copyright (c) 2014 Karel Vuong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  1. https://github.com/karelvuong/st-primer/blob/master/LICENSE

Can the project have the same licence?


Related issues:

  1. gamcoh/QuickEdit#2 Can it be an open source project?
  2. SublimeText/LaTeXTools#1175 Can it be an open source project?

Connecting with Postgres

Could someone kindly document exactly how to connect to a Postgres database? The settings shown on http://lubriciousdevelopers.github.io/projects/sublime-sql-exec/ and here are vague and conflicting at best. It is recommended to use the pgpass.conf method yet the sample configuration file on lubriciousdevelopers web site shows much of the same information that .pgpass provides

"Connection 2": {
    "type"    : "pgsql",
    "host"    : "127.0.0.1",
    "port"    :  5432,
    "username": "anotheruser",
    "database": "dbname"
 },

What is the exact string necessary for "sql_exec.commands" in SQLExec.sublime-settings? A sample syntax for MySQL is provided but not for any others. A sample for pgsql would help greatly for its methods of execution are not as simple as other software.

I have spent the better part of an hour to make this work on Postgres to no avail. Setting up for MySQL was a snap,

As a web developer I run MySQL and Postgres. This is from my SQLExec.sublime-settings file:

{
    "show_result_on_window" : true,

    "sql_exec.commands": {
      "mysql" : "/usr/bin/mysql",
      "pgsql" : "psql",  
//In my  Ubuntu environment: set PGPASSFILE=~/.pgpass. 
//.pgpass conforms with hostname:port:database:username:password
    },
    "connections": {
         "Connection 1": {
             "type"    : "mysql",
             "host"    : "127.0.0.1",
             "port"    : 3306,
             "username": "root",
             "password": "a_password_entered-here",
             "database": "a_db"
        },
         "Connection 2": {
             "type"    : "mysql",
             "host"    : "127.0.0.1",
             "port"    : 3306,
             "username": "root",
             "password": "a_password_entered-here",
             "database": "a_db"
        },
         "Connection 3": {
             "type"    : "pgsql",
             "host"    : "127.0.0.1",
             "port"    : 5432,
             "username": "a_username_is_entered_here",
             "password": "a_password_entered-here",
        }
    }
}

sublime text crashes

Every time i try to execute a simple select query my SublimeText crashes !

this is my settings:
{
"sql_exec.debug": true,
"sql_exec.commands": {
"mysql" : "C:/wamp/bin/mysql/mysql5.6.12/bin/mysql.exe"
},
"connections": {
"Connection 1": {
"type" : "mysql",
"host": "127.0.0.1",
"port": 80,
"username": "root",
"password": "",
"database": "test"
}
}
}

any solution ?

Is it possible to cancel a query?

I really like your tool and happily use it regularly. Sometimes I issue a wrong query (e.g. I forget to limit a query which results in a time-consuming query). Is it possible to cancel the issued query? (Like ctrl+c in the terminal.)

Fresh install doesn't work on SublimeText 3

I did a fresh install via the Package Manager and when I try to list the connection list nothing happens and I get this in the ST3 console:

File "SQLExec in /home/andrei/.config/sublime-text-3/Installed Packages/SQLExec.sublime-package", line 140, in sqlChangeConnection
IndexError: list index out of range

Even if I add some connections here:
( Preferences > Package Settings > SQLExec > Settings - User )
It still crashes.

I hope this reproduction helps you.
Thanks,
Andrei

When trying to run query: "KeyError: 'before'"

I'm trying to connect to Vertica with VSQL.
Plugin is installed in ST3 on Ubuntu 14.04.

Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 526, in run_
return self.run()
File "SQLExec in /home/cc/.config/sublime-text-3/Installed Packages/SQLExec.sublime-package", line 183, in run
File "SQLExec in /home/cc/.config/sublime-text-3/Installed Packages/SQLExec.sublime-package", line 35, in desc
File "SQLExec in /home/cc/.config/sublime-text-3/Installed Packages/SQLExec.sublime-package", line 18, in _getCommand
KeyError: 'before'

Error: The system cannot find the path specified.

I installed sqlexec and this is my configuration in ( Preferences->Package Settings->SQLExec->Settings User ):
{

"connections": {
    "Connection 1": {
        "type": "mysql",
        "host": "127.0.0.1",
        "port": 3306,
        "username": "root",
        "password": "1234",
        "database": "zlcms"
    },
},
"sql_exec.commands": {
    "mysql": "C:\\xamp\\mysql\\bin\\mysql.exe"
}

}
i think mysql path is wrong, i try changing the path to "C:/xamp/mysql/bin/mysql.exe" but it's not working, please help me!.

mysql connection doesn't work if user has no password

sublime text 3 beta gets blocked when password is set to empty. Maybe mysql asks for password and never returns anything. Solved by deleting "-p" parameter in file mysql.sqlexec:

From: "args": "-h{options.host} -P{options.port} -u{options.username} -p{options.password} -D{options.database}",

To: "args": "-h{options.host} -P{options.port} -u{options.username} -D{options.database}",

Output results to a sublime window/REPL style

Any chance of displaying the results in a sublime window instead/optionally?
Then you can take advantage of all of sublime's editing features, whereas it doesn't seem like you can search/multi select etc in the output pane.

ctrl+alt+e key-binding not working at all on mac

When I press 'ctrl+alt+e' key-binding to select connection, it doesn't try to do anything. Works great on my linux box at home. Just won't try at all on my mac box. I've tried sublime.log commands to True to see commands in the console and when I press 'ctrl+alt+e'...nothing. What can I do?

PGSQL postgres connector disconsiders password (workaround found)

Hi there,

currently a connection like this discosiders the password:

{
    "connections": {
        "dev": {
            "type"    : "pgsql",
            "host"    : "localhost",
            "port"    : 5432,
            "username": "username",
            "password": "passssssword",
            "database": "dev"
        }
    }
}

pgsql.sqlexec does not apply options.password anywhere (because the psql command does not support it, I am aware).

However, you can give the password as a PGPASSWORD parameter in bash. Hence, here is my current workaround for if anybody needs it:

{
    "sql_exec.commands": {
        "pgsql"  : "PGPASSWORD=passssssword /usr/local/bin/psql",
    },
    "connections": {
        "dev": {
            "type"    : "pgsql",
            "host"    : "localhost",
            "port"    : 5432,
            "username": "username",
            "password": "",
            "database": "dev"
        }
    }
}

MySQL no-password connection, and some ideas

Connecting with a MySQL user that does not use a password does not seem to be possible with this plugin as it currently stands. It would just take a change to line 5 at https://github.com/jum4/sublime-sqlexec/blob/master/sgbd/mysql.sqlexec for that, but alas I just use the following instead:

http://bartinger.at/execute-mysql-from-sublime-text-2/

Hope this helps.

BTW It's much nicer to execute the query from the currently open source file than from the console... it would be cool to format the results like this plugin does, but execute the currently open file.

When i use ctrl e 2x dont do anything

When i use ctrl+e ctrl+e dont do anything, i follow all the steps :S

Console error:

Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./SQLExec.py", line 200, in run
File "./SQLExec.py", line 29, in execute
File "./SQLExec.py", line 88, in show
File "./SQLExec.py", line 74, in _result
File "./SQLExec.py", line 66, in _display
AttributeError: 'Window' object has no attribute 'create_output_panel'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.