Darik Gamble
1355665270
format_output takes an extra arg instead of referencing pgspecial directly
...
This also allows us to simplify some of the tests in test_pgexecute,
which tested with and without expanded output by first running '\x',
which is a pretty roundabout way of mutating a global variable
2015-06-30 11:28:06 -04:00
Amjith Ramanujam
7c6c56de6b
Fix the failing tests for expanded output.
2015-06-21 00:03:43 -07:00
Daniel Rocco
40149ad648
Add tests for fuzzy ranking adjustments.
2015-06-16 08:35:42 -04:00
Darik Gamble
4e46c01d3c
Gross test that \dt, \df etc. run without error
2015-05-23 08:33:42 -04:00
Darik Gamble
9e621ba97c
Support \dT to list datatypes
2015-05-23 08:33:42 -04:00
Darik Gamble
128264057e
Suggest custom types in addition to built-ins
2015-05-23 08:33:41 -04:00
Darik Gamble
5692782bd2
Give pgexecute a datatypes() method to get custom type names
...
Not used yet
2015-05-23 08:33:39 -04:00
Darik Gamble
a169f01609
Suggest datatypes from a hardcoded whitelist
2015-05-23 08:33:39 -04:00
Darik Gamble
bd3d0fb924
Add test to find_prev_keyword for parentheses
2015-05-23 08:32:13 -04:00
Darik Gamble
70732f0025
drop schema
and create schema
should suggest schemas
2015-05-20 17:59:32 -04:00
Amjith Ramanujam
f906183b7e
Fix a typo in the test fixture setup.
2015-05-14 08:40:27 -07:00
Amjith Ramanujam
0c9c51b4f7
Fix failing tests in Python 2.
2015-05-11 13:34:47 -07:00
Darik Gamble
e060dd398e
improve suggestions in non-trivial WHERE clauses
...
sqlparse groups tokens belonging to the where clause into a single Where token (a subclass of TokenList). In order to handle cases beyond the simplest `SELECT * FROM foo WHERE`, we need to look "inside" of this token list.
2015-05-02 17:33:25 -04:00
Darik Gamble
ff9caf45f4
improve find_prev_keywords
...
1) Add clarifying comments
2) Fix bug where a keyword inside of a TokenList would result in a ValueError
3) Ignore as keywords a fixed list of logical operators
2015-05-02 17:33:23 -04:00
Iryna Cherniavska
dc3f094b1b
Implemented external editor call.
2015-04-20 09:11:36 -07:00
Daniel Rocco
7fe802a33f
Add suggest tests for INSERT INTO, COPY, UPDATE, DESCRIBE, JOIN, and TRUNCATE
2015-04-18 17:34:59 -04:00
Amjith Ramanujam
f4c5e5ae30
Add an extra test for the JOIN USING for good measure.
2015-04-17 09:39:02 -07:00
Amjith Ramanujam
049c51b971
Merge pull request #190 from darikg/joins
...
some join-related improvements
2015-04-16 22:30:38 -07:00
Amjith Ramanujam
7d4e57090c
Merge pull request #202 from drocco007/feature/match-anywhere
...
Completion search text matches user-defined entities anywhere in the name
2015-04-15 06:29:43 -07:00
Amjith Ramanujam
dc94ca3820
Merge pull request #195 from darikg/pg_catalog
...
Improve handling of pg_catalog in metadata
2015-04-14 17:07:28 -07:00
Daniel Rocco
76b44443d1
Completion search text matches user-defined entities anywhere in the name
...
When searching for completions in smart completion mode, a potential
suggestion of a user-specified name (e.g. tables, functions, etc.) is
considered a match if the search text appears anywhere in the
suggestion. Keywords, special commands, and built-in functions still
use startswith matching.
Closes #193
2015-04-12 21:21:51 -04:00
Daniel Rocco
e85116d846
Handle a ',' entered before any completions gracefully
...
Fixes #197
2015-04-11 09:55:34 -04:00
Darik Gamble
41007c549e
bugfix: don't exclude any schemata from metadata queries
2015-04-09 13:00:57 -04:00
Darik Gamble
90974ecff8
support 'JOIN ... USING (' by suggesting columns present in more than one table
2015-04-07 15:43:29 -04:00
Darik Gamble
c7307e5a7d
find_prev_keyword strips everything after the last keyword
2015-04-06 18:30:05 -04:00
Darik Gamble
1fad19a584
bugfix: extract_tables stopped prematurely on INNER JOIN et al
...
check for value.endswith('join') instead of just value == 'join'
2015-04-06 06:30:56 -04:00
Darik Gamble
070b138cf3
bugfix: suggestions were broken after specifying a join type
...
because sqlparse parses things like 'inner join' as a single token, simply checking if token value
matches 'join' fails on further specified join types
2015-04-06 05:52:38 -04:00
Darik Gamble
05dac16040
suggest view names
2015-04-05 16:38:04 -04:00
Darik Gamble
d437f0cabf
pgexecute supports returning view metadata
...
generalize tables() to _relations(relkind_filter), and add convenience methods tables() and views() which simply call _relations() with the appropriate relkind_filter value
similarly, generatize columns() to _columns(relkind_filter), and add convenience methods table_columns() and view_columns()
2015-04-05 16:38:02 -04:00
Amjith Ramanujam
a80eb4ea19
Add a title field and report the notices. Closes #177
2015-03-25 00:26:38 -07:00
Daniel Rocco
9124df2364
Format Decimal values directly as strings
...
Closes #169
2015-03-11 00:59:36 -04:00
Amjith Ramanujam
55120a9958
Merge pull request #170 from darikg/better_dots
...
Better handle schema qualifications in current word
2015-03-08 17:50:23 -07:00
Darik Gamble
2b85eaecb0
Better handle schema-qualified word_before_cursor
...
Previously, if the current word contained a period, `suggest_type` would parse text to the right of the period as `word_before_cursor`, so that characters to the left of the period were parsed as the final token. Then `suggest_based_on_last_token` would generate suggestions under the generic catch-all `elif token_v.endswith('.')`. This means that, for example, `DROP TABLE schema_name.<TAB>` and `DROP FUNCTION schema_name.<TAB>` would each suggest both tables and functions from schema_name.
This commit changes this behavior to include schema qualifications as part of word_before_cursor, so that `suggest_based_on_last_token` operates on the actual preceding token, not just the schema name. This allows each token value to handle schema qualifications differently, and now `DROP TABLE schema_name.<TAB>` suggests only tables from schema_name, and the corresponding `DROP FUNCTION` command only functions.
2015-03-06 08:26:41 -05:00
Daniel Rocco
8e919f1b6c
Interpret incoming JSON as a string instead of via json.loads
...
Closes #163
2015-03-01 00:40:46 -05:00
Darik Gamble
bccde788f3
Watch out for leading whitespace
2015-02-28 08:43:34 -05:00
Darik Gamble
687578eafb
\dn suggests schemas only
2015-02-27 10:06:44 -05:00
Darik Gamble
5d44904aa3
\df suggests only schemas and functions
2015-02-27 10:04:59 -05:00
Darik Gamble
1fa910b7fd
Move pgspecial suggestions to separate method
2015-02-27 10:02:12 -05:00
Amjith Ramanujam
eded02a0a8
Add a test for the special multi-command case.
2015-02-26 23:28:21 -08:00
Daniel Rocco
2f34fbafd6
Only include special command completions at the start of a statement
...
Closes #159
2015-02-25 16:58:01 -05:00
Daniel Rocco
840f3bd3a8
Add completion for CREATE WITH TEMPLATE
...
Closes #156
2015-02-24 12:44:32 -05:00
Darik Gamble
22ed9ddb86
Autocomplete function names
2015-02-17 12:35:56 -05:00
Darik Gamble
896297c440
Store function metadata (not used yet)
2015-02-17 11:38:22 -05:00
Amjith Ramanujam
7091dce672
Revert psycopg2cffi to psycopg2.
2015-02-08 14:54:57 -08:00
Amjith Ramanujam
c5c3047b90
Convert to use cffi. But unicode isn't working.
2015-02-06 22:58:59 -08:00
Amjith Ramanujam
f956fa80ea
Add a test for the boolean printing.
2015-01-31 16:38:47 -08:00
Amjith Ramanujam
d324b27e41
Replace splat import in tests.
2015-01-30 18:59:09 -08:00
Amjith Ramanujam
cf0f33ff01
Add a test for the unicode handling in unknown types.
2015-01-30 18:15:40 -08:00
darikg
13f84bf83e
Fix #106 - autocompletion in multiple statements
2015-01-28 18:21:13 -05:00
Amjith Ramanujam
27a363ee06
Fix broken tests.
2015-01-27 23:12:15 -08:00
Darik Gamble
7d3f276e83
Fix \d special command and add some tests
2015-01-26 08:30:55 -05:00
Darik Gamble
cbca9c62df
Split up smart completion tests into two files
...
One file for simple public schema only tests, and another more focused on schema-aware autocompletion
2015-01-25 16:41:03 -05:00
Darik Gamble
89cffd18ba
Fix failing tests in python 3 by converting dictionaries to tuples so sorted can sort them
2015-01-25 13:15:01 -05:00
Darik Gamble
830d1beaa8
Remove pandas dependency by storing database metadata as lists of tuples
2015-01-25 11:39:03 -05:00
Darik Gamble
7e7051fef7
Merge branch 'master' into schema_autocomplete
2015-01-25 11:37:46 -05:00
Amjith Ramanujam
d2c79d8240
Remove the custom parse_dsn function.
2015-01-23 22:31:37 -08:00
Daniel Rocco
52b684574e
Cast bytea fields to text for output.
2015-01-21 22:50:24 -05:00
Iryna Cherniavska
13f3af72c3
ON keyword now suggests tables and aliases on the right side of equal sign also.
2015-01-19 17:03:44 -08:00
Darik Gamble
98b064b829
fix schema-handling in tests
2015-01-19 13:04:50 -05:00
Amjith Ramanujam
41927cd8d3
Merge branch 'master' into pr127
2015-01-18 22:08:52 -08:00
Amjith Ramanujam
1e59d7a946
Add tests for auto-escaped tables/columns.
2015-01-18 21:52:25 -08:00
Darik Gamble
8bba43e1d7
Add missing import
2015-01-18 19:04:24 -05:00
Darik Gamble
cc6276925f
Get schema names with a direct query instead of stripping them from the tables metadata so we can autocomplete schemata without tables in them
2015-01-18 18:27:25 -05:00
Darik Gamble
78288101c2
Make autocomplete schema-aware
2015-01-18 15:53:47 -05:00
Iryna Cherniavska
c4c61b8ce5
ON keyword suggests either table aliases, or table names.
2015-01-17 22:16:53 -08:00
darikg
ffeb89e406
fix bug where show_help command failed in python 3 due to iteritems() deprecation
2015-01-14 15:19:23 -05:00
Karl-Aksel Puulmann
89547a171e
Support having multiple queries on the same line.
...
Note that if any of the queries raises an error, nothing besides the error is
output. This is different behavior from psql which outputs separately for each
query:
_test_db=# select 1; invalid syntax; select 2;
?column?
----------
1
(1 row)
ERROR: syntax error at or near "invalid"
LINE 1: invalid syntax;
^
?column?
----------
2
(1 row)
2015-01-10 11:55:35 +02:00
Karl-Aksel Puulmann
498257cf37
Fix expanded output package under python 3, add tests for unicode support.
2015-01-09 12:53:42 +02:00
Karl-Aksel Puulmann
b54823c96a
Fix problem with travis not using correct python versions when testing.
2015-01-09 12:33:27 +02:00
Karl-Aksel Puulmann
9632546c4b
Do only one query for all columns, instead of len(tables) queries. Should fix #25
2015-01-09 00:16:55 -08:00
Karl-Aksel Puulmann
b7f9c00c21
Fix issues pointed out in pull request comments.
2015-01-09 00:14:18 -08:00
Karl-Aksel Puulmann
8307a7e642
Simplistic test
2015-01-09 00:14:18 -08:00
Karl-Aksel Puulmann
a87f3a1fcc
Checking if database exists and some initial fixtures which clean up
2015-01-09 00:13:19 -08:00
Stuart Quin
decb370f88
Add test for expected output
2015-01-08 23:38:54 -08:00
Karl-Aksel Puulmann
d566ff3286
Remove the extra tox.ini
2015-01-07 21:55:27 +02:00
Amjith Ramanujam
4e862015f8
Mark the multicolumn sub-select test to xfail.
2015-01-04 23:23:48 -08:00
Amjith Ramanujam
b61663a65c
Move parse_dsn tests to test folder instead of doctests.
2015-01-04 16:20:52 -08:00
Amjith Ramanujam
922a74d58a
Add tox and fix python3 failures.
2015-01-02 00:04:01 -08:00
Amjith Ramanujam
a4460f17cc
Remove the debug statment left in tests.
2015-01-01 00:16:43 -08:00
Amjith Ramanujam
6e622d6dde
Add initial completion support for JOIN statements.
2015-01-01 00:07:31 -08:00
Amjith Ramanujam
1cfdb4c55a
Extract tables from JOIN statements.
2014-12-31 23:17:50 -08:00
Amjith Ramanujam
16af5d0ec1
Add keyword completion for sub-select.
2014-12-30 21:46:16 -08:00
Amjith Ramanujam
0fa38b0e4f
Fix another corner case for table name extraction in nested sql.
2014-12-30 00:22:48 -08:00
Amjith Ramanujam
65c7cdaafa
Fix the table extraction for nested select statement.
2014-12-29 21:43:41 -08:00
Iryna Cherniavska
799d4bc35b
Added tests for multiple column suggestion, dot and alias.
2014-12-28 14:57:51 -08:00
Iryna Cherniavska
335e57215c
added tests for dot and alias
2014-12-27 14:43:49 -08:00
Iryna Cherniavska
5b4644ba34
added naive completion tests
2014-12-27 13:49:35 -08:00
Amjith Ramanujam
665f5e9d0a
Remove the debug statmenet.
2014-12-26 00:41:45 -08:00
Amjith Ramanujam
9763ddb95c
Fix the table parsing for update and add a test.
2014-12-26 00:32:56 -08:00
Amjith Ramanujam
be322144c3
Fix multiple columns for aliased tables.
2014-12-25 02:08:31 -08:00
Amjith Ramanujam
7492594c37
Improve the Insert completion.
2014-12-25 01:55:00 -08:00
Amjith Ramanujam
09c5f28abe
First attempt at dot completion and alias detection.
2014-12-24 23:56:12 -08:00
Amjith Ramanujam
b432811a21
Refactor sqlcompletion to make it work for multiple cols and tables.
2014-12-24 01:32:01 -08:00
Amjith Ramanujam
351686fa33
Make parseutils to work with hanging comma and insert statements.
2014-12-24 00:16:08 -08:00
Iryna Cherniavska
6933b72cb9
added some smart completion tests
2014-12-23 23:59:14 -08:00
Amjith Ramanujam
6a9b224834
Add tests for parse_utils.extract_tables.
2014-12-23 23:29:26 -08:00
Amjith Ramanujam
080675ba0f
Add a check for partially entered col name.
2014-12-20 23:38:48 -08:00
Amjith Ramanujam
c6926dda0a
Add a test for where clause and rename all tests functions.
2014-12-20 22:28:30 -08:00
Amjith Ramanujam
23f3ae3028
Cleanup sql_completion tests.
2014-12-20 14:18:28 -08:00
Iryna Cherniavska
e287787045
attempt to suggest column name when function is typed
2014-12-18 13:57:40 -08:00
Amjith Ramanujam
1b8d11a3e7
Add default config file to setup.py.
2014-12-11 08:59:42 -08:00
Amjith Ramanujam
e3f7d263f3
Add test plan and place holder stubs.
2014-12-09 23:14:49 -08:00