tosher / tsqleasy Goto Github PK
View Code? Open in Web Editor NEWTSQL Easy is a plugin for Sublime Text, that adds possibility to read/write/execute sql requests to Microsoft SQL Server through the use of pyodbc library.
License: Other
TSQL Easy is a plugin for Sublime Text, that adds possibility to read/write/execute sql requests to Microsoft SQL Server through the use of pyodbc library.
License: Other
Hello, the error above continues to pop up when I am using TSQL package in ST3. Unfortunately, the error popup does not let me copy and paste the error message.
I am only interested in using the TSQL package as a TSQL syntax highlighter, not to actually connect to / run queries against a DB with a Microsoft SQL Server connection.
Please let me know if any system information is required to further troubleshoot this issue.
I get the following error every time I attempt to run an queries:
[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]Specified SQL Server not found. (6) (SQLDriverConnect)
I'm not entirely sure I have configured the connection appropriately:
{
"te_sql_server":
{
"Main": {
"driver": "SQL Server",
"server": "serverName\\machine",
"server_port": 1433,
"username": "",
"password": "",
"database": "dbName",
"autocommit": true
}
}
}
The two things I can think that might cause the issue are:
File "/home/user/.config/sublime-text-3/Packages/TSQLEasy/sqlodbccon.py", line 83, in dbconnect
except pyodbc.IntegrityError as e:
NameError: global name 'pyodbc' is not defined
TSQLEasy: PyODBC is not available: libodbc.so.1: cannot open shared object file: No such file or directory
But, pyodbc is available in the system.
System Python version 2.6.6.
ST3 (3103)
CentOS 6.7 Release
Did the settings, open the console with ctrl + shift + c and choose the database with ctrl + alt + after it create a query and try to run with ctrl + shift + and fails.
By sql server managment can connect to this server
My config of the bank is as follows:
{
"te_sql_server":
{
"Main": {
"driver": "SQL Server",
"server": "127.0.0.1",
"server_port": "1433",
"username": "",
"password": "",
"database": "",
"autocommit": true
},
"Offline": {
"driver": ""
},
"SIGE_9999": {
"driver": "SQL Server",
"server": "10.0.1.3",
"server_port": "1433",
"username": "SIGE_9999",
"password": "uni4501789",
"database": "SIGE_9999",
"autocommit": true
}
},
"te_server_active": "Main",
"te_encodings":
{
"main_profile": "cp1251"
},
"te_sql_profile": "main_profile",
"te_procedure_path": [],
"te_result_in_new_tab": true,
"te_show_request_in_result": false
}
I was happy to see that if I had a part of a window selected that only that part was being executed.
I was less happy to see that when I had more than one statement (an update statement and a select statement) in one window, only the first one would be executed. The result window would say there was no result set, even though certain the select statement should return a result set.
If the syntax highlighter encounters a string literal ('foo'
) that is at least 3 characters long and ends in 'on'
or ',n'
, the ending apostrophe will be ignored and all following characters interpreted as part of the string literal (i.e. everything turns green).
Smallest reproduction case: include the string literal 'Jon'
or 'J,n'
in your project file, watch everything turn green.
Real world case:
IF NOT EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = 'Automation')
everything after this line turns green until the next apostrophe.
EDIT: thinking on this, it looks like recognition for the first apostrophe was copy-pasted to the second apostrophe, which is not correct since the first has to handle the case of N'foo'
, and the above are edge cases which apply to detecting N'
.
Incidentally, the comma issue means that there might be something similar lurking for N''
literals preceded by a comma, tho I am unable to find an example that is syntactically correct.
After installation in the console:
TSQLEasy: PyODBC was loaded successfully.
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 109, in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/init.py", line 90, in import_module
File "", line 1584, in _gcd_import
File "", line 1565, in _find_and_load
File "", line 1532, in _find_and_load_unlocked
File "", line 584, in _check_name_wrapper
File "", line 1022, in load_module
File "", line 1003, in load_module
File "", line 560, in module_for_loader_wrapper
File "", line 868, in load_module
File "", line 313, in call_with_frames_removed
File "C:\Users\AppData\Roaming\Sublime Text 3\Packages\TSQLEasy\tsqleasy.py", line 6, in
from .base import *
File "C:\Users\AppData\Roaming\Sublime Text 3\Packages\TSQLEasy\base_init.py", line 4, in
from .te_set_active_server import TsqlEasySetActiveServerCommand
File "C:\Users\AppData\Roaming\Sublime Text 3\Packages\TSQLEasy\base\te_set_active_server.py", line 6, in
from . import te_utils as utils
File "C:\Users\AppData\Roaming\Sublime Text 3\Packages\TSQLEasy\base\te_utils.py", line 9, in
from ..libs.terminaltables.other_tables import WindowsTable as SingleTable
File "C:\Users\AppData\Roaming\Sublime Text 3\Packages\TSQLEasy\libs\terminaltables_init.py", line 9, in
from terminaltables.ascii_table import AsciiTable # noqa
ImportError: No module named 'terminaltables'
Thank you in advance!
Hi,
How do I run a sql script in batch manner as I would do in SQL Server Management Studio?
Thanks.
I have SQL Server installed on my laptop, I only access this on the laptop never remotely from another computer. I have Sublime Text installed and would like to use it to query the SQL Server instance I have running locally. I am having a hard time figuring out how I should connect, you have a previous reply to another thread containing this:
Preferences -> Package settings -> TSQLEasy -> Settings - User:
"te_sql_server":
{
"Offline":
{
"driver": ""
},
"Server1":
{
"autocommit": true,
"database": "dbname1",
"driver": "SQL Server",
"password": "password1",
"server": "ip_address1",
"server_port": "1433",
"timeout": 1,
"username": "username1"
},
"Server2":
{
"autocommit": true,
"database": "dbname2",
"driver": "SQL Server",
"password": "password2",
"server": "ip_address2",
"server_port": "1433",
"timeout": 1,
"username": "username2"
}
}
Since the server is running on my laptop, what settings would I need to use, would a server port still be applicable? as well as the IP address?
I'd like another option other than using the management studio. Thank you in advance.
I wrote in my query
EXEC MySchema.MyProcedure
Now, what should I do to open its code? Everything is working fine except this. I tried to highlight MySchema.MyProcedure and only MyProcedure and run every command shown by ctrl+shift+p 'TSQL Easy:' but it won't work.
Hi Thanks for useful extension
How could I connect to DB ? I have a connection string like
<add name="MainDatabase" connectionString="Server=YasdaC-NTB; Database=asd; User=asd; Password=asd123; Application Name=asdWeb_English;" />
I'm trying to use TSQLEasy to connect to a server that uses Windows Authentication. I see that this can be done with pyODBC using "Trusted_Connection=yes" rather than a user name and password. Is there a way to use this within the TSQLEasy settings?
Thank you!
I feel pretty dumb, but I've installed TSQLEasy in Sublime but cannot for the life of me figure out how to define a server. I am only given two options: Main and Offline. How do I connect to an external server? There's unfortunately no documentation on how to just set this up that I can find.
I'm having some issues getting this to work and was hoping for some guidance. I'm running OS X 10.10 and using Sublime Text 3. I installed TSQLEasy using package control with no issues. I set my server information by going to Sublime Text > Preferences > Package Settings > TSQL Easy > Settings - Default. I filled in the information for server, username, password, and database. I go to the command palette and choose TSQL Easy Server Select and choose "Main". From the document type selector in the bottom right hand corner I choose T-SQL. I then start typing code and autocomplete is not showing tables in my database. I typed a simple select statement, highlighted the statement, went back to the command palette an chose TSQL Easy Execute and nothing happens.
Any guidance you can provide will be helpful. Thanks.
How do I use Windows Authentication?
When column name contains a dot (.)
, formatting does not work correctly. E.g.
CREATE TABLE [customer_order] (
[derived_id] bigint NOT NULL PRIMARY KEY NONCLUSTERED NOT ENFORCED,
--hash(order_id) may not be needed
[order_id] varchar(80) NOT NULL,
[buyer.primary_id] varchar(80) NOT NULL,
[buyer_name] varchar(128) NOT NULL,
[supplier.primary_id] varchar(80) NOT NULL,
[supplier_name] varchar(128) NULL,
...
Link: https://imgur.com/a/LX1D4GN
line 6 and 9, words buyer
and supplier
should not be colored green.
I've installed the plugin but I have no idea how to configure the connection to the DB
The toggle comment comand (Ctrl+/) does not work when language is selected as T-SQL
Hello.
I was wondering if you could help me in my package SQLTools
It's supposed to do de same as yours, but I dont have expertise in MSServer so I hope you could help me.
We could share experiences to make both packages valuable for users.
Hope you agree to join me in this adventure.
[]s.
M.
Sublime is frozen and just to other screen. Have to uninstall this package, then issue disappears.
I can execute by using ctrl+shift+p
and using the tsql execute command
from there but any macro I set or even using the default it doesn't execute the query
I managed to install and fire my first query pretty easily, but I can't get the other features to work (code completion, procedure under cursor, ...).
I don't want to doubt the quality of the package, since it seemed to work right out of the box, but a little help with those other features is wanted here.
After installation on my Ubuntu machine, i am trying to connect to a server but am running into this problem when connecting. It worked on my windows machine without problems. any ideas here?
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./tsqleasy.py", line 496, in run
File "./tsqleasy.py", line 84, in te_get_connection
File "./sqlodbccon.py", line 42, in init
File "./sqlodbccon.py", line 72, in dbconnect
NameError: global name 'pyodbc' is not defined
Thanks in advance!
Vin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.