Граф коммитов

205 Коммитов

Автор SHA1 Сообщение Дата
samir-puranik 8aac258e69
Add cascade to drop for trigger and properly format drop script for functions/procedures/trigger functions (#476) 2023-09-01 16:34:31 -04:00
samir-puranik adb2be3eb4
Change default DB for cosmos to be 'citus' (#470)
Changed the default database for an Azure Cosmos PG server to be 'citus' instead of 'postgres'
2023-08-28 15:44:43 -04:00
samir-puranik ead422b848
During CREATE script for tables, add CREATE scripts for its associated indexes and triggers (#469)
This PR adds index CREATE and trigger CREATE scripts to the table CREATE script. In the process the following was also changed/updated:
- Trigger templates updated
- Tests for scripting on tables updated to include checks for index and trigger scripts
- Test for trigger updated to use `FUNCTION` instead of `PROCEDURE` because mock server is version 13. The version 13 template uses `FUNCTION` instead
- Index create scripts include `IF NOT EXISTS`
- The metadata.schema value for Indexes and Triggers stores `f'{schema}.{table_or_view_name}'`
- Triggers are now scriptable
- The way Indexes are fetched during scripting is slightly different than before, but more similar to how Triggers are fetched. This is because they are both table_objects
- Indexes are now scriptable even under materialized views
2023-08-28 15:14:03 -04:00
Daeun Yim 24a048226f
Fix converters and add tests (#468)
* Fix converters and add tests

* Remove unnecessary var

* Change every converters into string converter

* Fix tests

* fi oid issue

* fix tests

* fix tests
2023-08-25 15:47:53 -07:00
nasc17 c3f1582088
Address broken connections during open sessions (#466)
* reconnect if broken

* update naming

* retry for broken connection during request

* change name of SCRIPTAS_REQUEST

* expand node broken connection

* reconnect during refresh if needed

* lint fix

* test fix init

* none checks for tests

* fix connection during errors

* return after script request exception

* use mock connection for server in test

* put back try catch block for node expansion

* validate error

* mock server

* mock server

* Revert "mock server"

This reverts commit 2cdeeea68f.

* Revert "put back try catch block for node expansion"

This reverts commit a87a34b52e.

* retry state

* add back exception in expand node base

* lint error
2023-08-24 18:50:45 -04:00
samir-puranik a7f10d8b76
Update to function templates (#467)
- Updated template files ensuring
    - add PgAdmin License header
    - change data.func_without_args to data.func_args
    - macros are being pathed to properly
- Using `.server` instead of `._server` outside of NodeObject class
- Added conn to FunctionBase query_data methods
2023-08-24 16:30:33 -04:00
samir-puranik eec418ec10
Fixes to indexes and constraints to be shown properly in OE (#463)
Addresses issues described in microsoft/azuredatastudio-postgresql#452 and microsoft/azuredatastudio-postgresql#453.

- Indexes should now show scripting options regardless of if they are unique or not
- Indexes will not show primary key, but this will show up in constraints. This is following the pattern of PgAdmin
- Constraints should properly show the associated constraints
    1. Check constraints
    2. Exclusion constraints
    3. Index constraints (primary key and unique key)
    4. Foreign key constraints
- Template files were updated for all constraint types
2023-08-23 13:29:39 -04:00
Daeun Yim 7bcc59e70b
Fix edge cases handling for date datetime timestamp (#461)
* Fix edge cases handling for date datetime timestamp

* Fix tests
2023-08-14 11:19:23 -07:00
nasc17 9ca14c5c99
Update RAISE command and Messages (#460)
* Add severity to notice and join by new line

* add severity to mock notice

* remove extra notice

* add new line separator in test

* print statements

* Revert "print statements"

This reverts commit b3a4aa6c68.
2023-08-11 17:07:24 -04:00
nasc17 db36614116
Nasc/send cursor status message (#457)
* use cursor status message

* remove transaction messages

* add status message to mock cursor
2023-08-11 16:57:21 -04:00
Daeun Yim 121e74d2ff
use psycopg function for parsing (#456) 2023-07-31 17:18:39 -07:00
Daeun Yim 397bf9b5bc
Fix session id connection error (#449)
* Fix broken language service

* fix session id failure

* remove unnecessary logging

* fix not ready error and test
2023-07-25 12:34:20 -07:00
nasc17 02b0365ddd
Psycopg3 Transactions update (#448)
* init

* notification handler

* include save point

* build and test issues

* fix status

* fix for setting back autocommit

* fix trans error check

* add transaction messaging

* fix open block

* fix text format

* test fix

* test

* update messages

* test message

* starts with begin
2023-07-25 15:26:19 -04:00
Daeun Yim d68ebe5fe5
Fix failing edit data test (#444)
* Fix broken language service

* fix test

* Revert "Fix broken language service"

This reverts commit f8ab759a49.

* style fix
2023-07-20 11:37:50 -07:00
samir-puranik 994259310a
Fixing CREATE script for Functions (#442)
Fixes create script for functions such that:

- Syntax is correct for immediate execution
- Function body is included for all versions (< 14 and >= 14)
- Should work for procedures and functions

Some template files needed to be changed slightly to prevent using the full properties that are generated for functions in pgAdmin.
2023-07-19 12:12:43 -07:00
nasc17 ede53c33e5
Addressing Save As issues from queries (#438)
* add delimiter

* check for exception

* display raw object sending to excel

* add line terminator

* add delimiter test

* fix failing tests

* fix assert

* fix assert
2023-07-13 16:26:15 -04:00
Daeun Yim a531607bb6
Psycopg version bump 2 to 3 (#428)
* Fix broken language service

* Fixing tests

* remove qt literals

* Fix test codes

* Fix psycopg2 code

* autopep

* test debugger

* Fix psycopg2 references
2023-06-14 14:48:16 -07:00
Pradeep Kintali 6ee4bb5c4f
Update build_pullrequest.yml (#416)
* Update build_pullrequest.yml

* Rename config.json.txt to config.json

* Update build_pullrequest.yml

to run ps1 script tests only for Windows.

* Update build_pullrequest.yml

* Update build_pullrequest.yml
2023-05-30 15:03:34 -07:00
nasc17 d1e24a84ca
Nasc/database list bug fix (#401)
* add new param

* fix error string

* build fix

* fix argument

* remove illegal option

* mock pg_dump path for test

* version 14

* Revert "remove illegal option"

This reverts commit 0da56482ef.

* fix materialized view space issue

* fix test failing in pipeline

* empty commit to trigger CI

---------

Co-authored-by: Daeun Yim <daeunyim@microsoft.com>
2023-05-09 15:57:20 -07:00
Daeun Yim 22fcaadd9d
Remove mysql component (#388)
* Remove mysql component (#382)

* Update initialize_request.py

* remove mysql component

* fix connection amanger file

* Fix style issue
2023-04-24 23:07:35 -07:00
Daeun Yim b48b4892e8
Resolve security component issue (#381)
* Resolve security alerts - update sqlparser version (#373)

* Update initialize_request.py

* bump up sqlparser

* Delete nose2-junit.xml

* Bump up sqlparse version (#375)

* Update initialize_request.py

* bump up sqlparser

* resolve dependencies - bumping up version

* Give specific sqlparse requirement to requirements.txt file (#377)

* Update initialize_request.py

* bump up sqlparser

* resolve dependencies - bumping up version

* give specific result to requirement sqlparse

* Testing test failures in pipelines (#378)

* Update initialize_request.py

* bump up sqlparser

* resolve dependencies - bumping up version

* give specific result to requirement sqlparse

* testing test failure in the pipeline

* test failure injection

* Inject failing test (#379)

* Update initialize_request.py

* bump up sqlparser

* resolve dependencies - bumping up version

* give specific result to requirement sqlparse

* testing test failure in the pipeline

* test failure injection

* inject failing test

* Revert back tests used for test failure injection (#380)

* Update initialize_request.py

* bump up sqlparser

* resolve dependencies - bumping up version

* give specific result to requirement sqlparse

* testing test failure in the pipeline

* test failure injection

* inject failing test

* Fix failing test_format_mysql_doc_range test

* Update scripts

* Remove unused test scripts

* Add mac test script
2023-04-19 16:34:30 -07:00
Daeun Yim a6bb065723
Bump up Python version to 310 (#369)
* Bump Up Python Version to 3.10 (#358)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* Fix build config and libraries (#359)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* Fixing integration tests (#360)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* test fix

* Fixing integration test issue in pipeline (#362)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* test fix

* adding test lines

* Fixing integration test issue in pipeline (#363)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* test fix

* adding test lines

* one more line print

* resolving integration test issue (#364)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* test fix

* adding test lines

* one more line print

* add encoding

* resolving integration test issue (#365)

* fix create as script bug

* Bump up python version and correct syntaxes

* nose to nose2

* Fix styles and unused imports

* fix build and library

* test fix

* adding test lines

* one more line print

* add encoding

* add encoding

* change config setting and remove printing lines in integration tests (#366)

* Fix style issue (#367)

* change config setting and remove printing lines in integration tests

* fix style issue

* Make flake file to return error when fail (#368)

* change config setting and remove printing lines in integration tests

* fix style issue

* add flake8 to return error when failing
2023-04-13 15:04:07 -07:00
Daeun Yim 7a7fb3b075
Add PG Restore/Dump for version 13 and Fix sequence in column and sequence object (#295)
* pgrestore and dump for version 13

* fix column object and add properties

* fix sequence object and column object

* Broken column object fixed

* style fixed
2021-10-06 10:20:34 -07:00
Daeun Yim 76d2fc3254
Fix document formatting issue (#294)
* fix typos

* fix formatting issue

* change extra test database to default one
2021-09-18 14:40:25 -07:00
Daeun Yim cae4e4ecc6
Fix integration tests and resurrect style tests
* downgrade prompt_toolkit add pydevd

* restore language tests for prompt_toolkit new version

* flake tests

* wrong file to test flake8

* Revert "wrong file to test flake8"

This reverts commit b373e399f7.

* configuration bug fix

* fix integration bug

* integration test error message fix

* add connection closing for integration tests

* Change config file logic

* integration test bug fix

* test integration bug fix

* remove config file

* Update integration test

* Update integration_tests.py

* Update integration_tests.py

* integration test bug fix

* Update integration_tests.py
2021-09-13 22:19:07 -07:00
Daeun Yim be5945baa1
Test restore, bug fixes, style test fixes (#288)
* Restore unit tests and minor bugs

* Integration tests fix and style fixed
2021-08-20 17:18:23 -07:00
swjain23 bed6e62806
Add backup support for all versions (#273)
* Add support for different versions for backup/restore

- Now dump and restore is supported for PG 9.5, 9.6, 10, 11, 12
- Added pg_dump executables and associated dlls for all versions of PG
- Based on the version of the server, it finds the folder where to look for pg_dump/pg_restore exe and uses that to execute backup and restore
2020-08-31 12:19:35 -07:00
Kevin Mao 483ff6b177
Refactor tools service to support MySQL provider (#267)
* Merge with MySQL/MariaDB branch

* Adjust services to be provider flexible, added MySQL support and re-branded pgtooslservice to ossdbtoolsservice.
2020-08-12 17:24:41 -04:00
Kevin Mao 3b0db546f9
Update PTVSD from 2.20 to 4.3.2 (#240)
* updated ptvsd

* Fixed flake8 errors
2020-06-15 16:24:00 -04:00
swjain23 45ca2267ed
Update psycopg to version 2.7.5 (#237)
* Update to 2.7.5

* Fixing flake error

* Replace is with ==
2020-04-23 13:15:00 -07:00
sergb213 3961d93402
do not convert json returned by the server (#235) 2020-03-20 15:01:52 -07:00
sergb213 7538e5adcb
Use original unformatted query text for execution (#234)
* use original unformatted query text for execution

* fix whitespace
2020-03-20 11:38:05 -07:00
Rich Smith a5cf430fdd Add ability for service to accept azureAccountToken from ADS client (#221)
* Code changes for AAD

* Fix check for key present in dict

* Add unit test to make sure account token is passed as PostgreSQL password.

* Remove extra import added by mistake.

* Fix static analysis errors
2020-01-21 19:42:11 -08:00
swjain23 7605304fb2
Deploy changes (#224)
* Changes for dpeloy

Adding deploy apis

* Remove tlc changes

* Fixing some build issues

* Rename execute_deploy_string_request to execute_deploy_request

* Fix for skipping intellisense for non pgsql language flavor

We are directly using the text document uri which is encoded, hence now using the decoded url which is by using file_url from script file.

Similar fix to mssql extension: https://github.com/microsoft/sqltoolsservice/pull/910

* Add tests for deploy request

* Revert "Fix for skipping intellisense for non pgsql language flavor"

This reverts commit 2aea459edd.
2020-01-21 14:49:59 -08:00
Anup N. Kamath dc634a4556
Include PG11 script files (#212)
* include pg11 script files

* Adding pgadmin4 header for pg11 scripts

* fix the memory view test
2019-06-09 18:55:52 -07:00
Anup N. Kamath 308a1e3a30
Fixing object explorer error (#205) 2019-03-16 15:05:03 -07:00
Anup N. Kamath e976b8215a
No column headers when a query returns 0 rows (#203)
* Handling cases where the query returns empty rows

* linting
2019-03-13 21:05:58 -07:00
ChrisSun-ms 195c7c2f80
Fix query protocol (#198)
* fix query protocol

* 01-09-(1)

* roll back

* query working

* remove dup

* fix test
2019-01-10 15:25:43 -08:00
Anup N. Kamath a6ee8efd3a
Fixed edit data changes (#194)
* Fixed edit data changes

* fixing instance type error in prompt_toolkit.completion

* flake8 latest version change recommended changes
2018-12-05 15:55:43 -08:00
ChrisSun-ms 8181e8f73e
Fixing Backup and Restore failure issue (#190)
* change disaster_recovery_service.py

* change to contract and test file

* fix styling
2018-02-28 15:17:39 -08:00
ChrisSun-ms 543b31e6e1
Fix function scripting bug (#189)
* init fix

* fix function script bug

* iter 2

* iter 2

* solve style and test failure

* iteration3
2018-01-26 12:59:21 -08:00
ChrisSun-ms 8c9dbbcd3e
disable test (#185) 2018-01-18 15:30:06 -08:00
ChrisSun-ms bd8a0cd659
Making scripting works fine for Database, Table, View, Schema and Function (#182)
* init pr - make sure scripting works solid

* init

* fixing style

* fix styling - 2
2018-01-16 14:53:45 -08:00
Anup N. Kamath e159f68de4
use temfile to create the file securely (#181)
* use temfile to create the file securely

* fixed the create file test
2018-01-15 19:26:30 -08:00
ChrisSun-ms 1bf41c0a6f
Add integration test for scripting service (#180)
* add integration test for scripting service

* fix pr comments
2018-01-09 10:46:38 -08:00
ChrisSun-ms 96f15e17b2
Switch on file storage for query (#179)
* enable file storage and related test change

* assertion changes

* solve editing data issue caused by switching to file storage

* fix PR comments
2017-11-30 17:12:50 -08:00
Anup N. Kamath 4138647edb
Serialization changes for PG (#177)
* Changes to enable serialization

* style fix

* Removed methods

* Fixed the file name
2017-11-17 16:52:42 -08:00
Praveen Barli a38548c08b
added metadata of objects for integration tests (#174)
* added objects for integration tests

* add locale id based on plat

* added displayname, removed collation
2017-11-13 13:25:35 -08:00
ChrisSun-ms e41772f731
add more data type and fix previous issue (#172) 2017-11-09 15:43:54 -08:00
Praveen Barli b6196b560c
added database change handler in ConnectionService (#170)
* added database change handler in ConnectionService

* replace code logic with handle connect request call
2017-10-27 12:53:51 -07:00