Skip to content

Commit 63cfbaf

Browse files
authored
Merge pull request #46 from stackql/feature/updates
added support for cmd specific env vars and auth
2 parents efaaea2 + e4058ae commit 63cfbaf

File tree

13 files changed

+361
-312
lines changed

13 files changed

+361
-312
lines changed

.github/workflows/async_server_tests.yaml.disabled

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ jobs:
1313
- windows-latest
1414
- macos-latest
1515
python-version:
16-
- "3.7"
1716
- "3.8"
1817
- "3.9"
1918
- "3.10"
2019
- "3.11"
2120
- "3.12"
22-
# - "3.13"
21+
- "3.13"
2322
exclude:
2423
- os: macos-latest
25-
python-version: "3.7"
24+
python-version: "3.8"
2625
runs-on: ${{matrix.os}}
2726
name: 'Run Tests on ${{matrix.os}} with Python ${{matrix.python-version}}'
2827

@@ -34,28 +33,35 @@ jobs:
3433
with:
3534
python-version: ${{ matrix.python-version }}
3635

37-
- name: Upgrade pip
38-
if: matrix.os == 'macos-latest'
39-
run: python${{ matrix.python-version }} -m pip install --upgrade pip
40-
4136
- name: Install dependencies from requirements.txt
4237
shell: bash
4338
run: |
4439
python3 -m pip install --upgrade pip
4540
pip install -r requirements.txt
4641
47-
- name: Install psycopg2 for non-Windows OS
48-
if: matrix.os != 'windows-latest'
49-
run: |
50-
pip install psycopg2-binary
51-
52-
# Windows specific
53-
- name: Install psycopg2-binary for Windows
42+
# Windows
43+
- name: Install psycopg
5444
if: matrix.os == 'windows-latest'
5545
run: |
56-
pip install psycopg2-binary
46+
pip install psycopg[binary]
5747
shell: powershell
58-
# End Windows specific
48+
# End Windows
49+
50+
# Linux
51+
- name: Install PostgreSQL dev libraries on Ubuntu
52+
if: matrix.os == 'ubuntu-latest'
53+
run: |
54+
sudo apt-get update
55+
pip install psycopg
56+
# End Linux
57+
58+
# macOS
59+
- name: Install PostgreSQL dev libraries on macOS
60+
if: matrix.os == 'macos-latest'
61+
run: |
62+
brew install postgresql@14
63+
pip install psycopg
64+
# End macOS
5965

6066
- name: Install pystackql
6167
run: |
@@ -66,9 +72,33 @@ jobs:
6672
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6773
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6874
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
75+
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
76+
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
77+
CUSTOM_STACKQL_GITHUB_USERNAME: ${{ secrets.CUSTOM_STACKQL_GITHUB_USERNAME }}
78+
CUSTOM_STACKQL_GITHUB_PASSWORD: ${{ secrets.CUSTOM_STACKQL_GITHUB_PASSWORD }}
79+
AWS_REGION: ${{ vars.AWS_REGION }}
80+
AWS_REGIONS: ${{ vars.AWS_REGIONS }}
81+
GCP_PROJECT: ${{ vars.GCP_PROJECT }}
82+
GCP_ZONE: ${{ vars.GCP_ZONE }}
83+
run: |
84+
python3 -m tests.pystackql_tests
85+
shell: bash
86+
if: matrix.os != 'windows-latest'
87+
88+
- name: Run tests on Windows
89+
env:
90+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
91+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
92+
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
93+
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
94+
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
95+
CUSTOM_STACKQL_GITHUB_USERNAME: ${{ secrets.CUSTOM_STACKQL_GITHUB_USERNAME }}
96+
CUSTOM_STACKQL_GITHUB_PASSWORD: ${{ secrets.CUSTOM_STACKQL_GITHUB_PASSWORD }}
6997
AWS_REGION: ${{ vars.AWS_REGION }}
7098
AWS_REGIONS: ${{ vars.AWS_REGIONS }}
7199
GCP_PROJECT: ${{ vars.GCP_PROJECT }}
72-
GCP_ZONE: ${{ vars.GCP_ZONE }}
100+
GCP_ZONE: ${{ vars.GCP_ZONE }}
73101
run: |
74-
python3 -m tests.pystackql_tests
102+
python3 -m tests.pystackql_tests
103+
shell: pwsh
104+
if: matrix.os == 'windows-latest'

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v3.7.0 (2024-11-08)
4+
5+
### Updates
6+
7+
- Added support for setting command specific environment variables (`env_vars` and `custom_auth`) in `execute` and `executeStmt`.
8+
- Upgraded to use `psycopg`
9+
310
## v3.6.5 (2024-09-19)
411

512
### Bug Fixes

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Before testing, ensure you have all the required packages installed:
166166
::
167167

168168
pip install -r requirements.txt
169-
pip install psycopg2-binary
169+
pip install psycopg
170170

171171
Once the dependencies are installed, you can run the tests using the provided script:
172172

docs/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
sphinx_rtd_theme
2-
psycopg2
32
pandas
43
requests
54
IPython

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ''
2828
# The full version, including alpha/beta/rc tags
29-
release = 'v3.6.5'
29+
release = 'v3.6.6'
3030

3131

3232
# -- General configuration ---------------------------------------------------

pystackql/_util.py

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def _get_download_dir():
3838
return site.getuserbase()
3939

4040
def _get_binary_name(platform):
41-
if platform == 'Windows':
41+
if platform.startswith('Windows'):
4242
return r'stackql.exe'
43-
elif platform == 'Darwin':
43+
elif platform.startswith('Darwin'):
4444
return r'stackql/Payload/stackql'
4545
else:
4646
return r'stackql'
@@ -82,25 +82,44 @@ def _download_file(url, path, showprogress=True):
8282
def _setup(download_dir, platform, showprogress=False):
8383
try:
8484
print('installing stackql...')
85-
binary_name = _get_binary_name(platform)
85+
binary_name = _get_binary_name(platform) # Should return 'stackql.exe' for Windows
8686
url = _get_url()
87-
print("downloading latest version of stackql from %s to %s" % (url, download_dir))
87+
print(f"Downloading latest version of stackql from {url} to {download_dir}")
88+
89+
# Paths
8890
archive_file_name = os.path.join(download_dir, os.path.basename(url))
91+
binary_path = os.path.join(download_dir, binary_name)
92+
93+
# Download and extract
8994
_download_file(url, archive_file_name, showprogress)
90-
# if Platform is starting with Darwin, then it is a MacOS
95+
96+
# Handle extraction
9197
if platform.startswith('Darwin'):
9298
unpacked_file_name = os.path.join(download_dir, 'stackql')
93-
command = 'pkgutil --expand-full {} {}'.format(archive_file_name, unpacked_file_name)
94-
# if there are files in unpacked_file_name, then remove them
99+
command = f'pkgutil --expand-full {archive_file_name} {unpacked_file_name}'
95100
if os.path.exists(unpacked_file_name):
96-
os.system('rm -rf {}'.format(unpacked_file_name))
101+
os.system(f'rm -rf {unpacked_file_name}')
97102
os.system(command)
98-
else:
103+
104+
else: # Handle Windows and Linux
99105
with zipfile.ZipFile(archive_file_name, 'r') as zip_ref:
100-
zip_ref.extractall(download_dir)
101-
os.chmod(os.path.join(download_dir, binary_name), 0o755)
106+
zip_ref.extractall(download_dir)
107+
108+
# Specific check for Windows to ensure `stackql.exe` is extracted
109+
if platform.startswith("Windows"):
110+
if not os.path.exists(binary_path) and os.path.exists(os.path.join(download_dir, "stackql")):
111+
os.rename(os.path.join(download_dir, "stackql"), binary_path)
112+
113+
# Confirm binary presence and set permissions
114+
if os.path.exists(binary_path):
115+
print(f"StackQL executable successfully located at: {binary_path}")
116+
os.chmod(binary_path, 0o755)
117+
else:
118+
print(f"ERROR: Expected binary '{binary_path}' not found after extraction.")
119+
exit(1)
120+
102121
except Exception as e:
103-
print("ERROR: [_setup] %s" % (str(e)))
122+
print(f"ERROR: [_setup] {str(e)}")
104123
exit(1)
105124

106125
def _get_version(bin_path):

0 commit comments

Comments
 (0)