Skip to content

Commit 99b0800

Browse files
committed
Merge remote-tracking branch 'remote.googleapis/python-spanner-sqlalchemy/main' into migration.python-spanner-sqlalchemy.migration.2026-03-09_19-05-52.migrate
2 parents afa0faa + 588ff02 commit 99b0800

123 files changed

Lines changed: 23383 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Code owners file.
2+
# This file controls who is tagged for review for any given pull request.
3+
#
4+
# For syntax help see:
5+
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
6+
7+
# The @googleapis/spanner-team is the default owner for changes in this repo
8+
* @googleapis/spanner-team
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Expected Behavior
2+
3+
4+
## Actual Behavior
5+
6+
7+
## Steps to Reproduce the Problem
8+
9+
1.
10+
1.
11+
1.
12+
13+
## Specifications
14+
15+
- Version:
16+
- Platform:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fixes #<issue_number_goes_here>
2+
3+
> It's a good idea to open an issue first for discussion.
4+
5+
- [ ] Tests pass
6+
- [ ] Appropriate changes to README are included in PR
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
assign_issues:
2+
- olavloite
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
name: SQLAlchemy Spanner dialect
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v6
14+
- name: Setup Python
15+
uses: actions/setup-python@v6
16+
with:
17+
python-version: 3.14
18+
- name: Install nox
19+
run: python -m pip install nox
20+
- name: Run Lint
21+
run: nox -s lint_setup_py lint blacken
22+
23+
unit:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v6
31+
- name: Setup Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
- name: Install nox
36+
run: python -m pip install nox
37+
- name: Run Unit Tests
38+
run: nox -s unit-${{ matrix.python-version }}
39+
env:
40+
SPANNER_EMULATOR_HOST: localhost:9010
41+
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
42+
43+
mockserver:
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v6
49+
- name: Setup Python
50+
uses: actions/setup-python@v6
51+
with:
52+
python-version: 3.14
53+
- name: Install nox
54+
run: python -m pip install nox
55+
- name: Run mockserver tests
56+
run: nox -s mockserver
57+
58+
samples:
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v6
64+
- name: Setup Python
65+
uses: actions/setup-python@v6
66+
with:
67+
python-version: 3.14
68+
- name: Install nox
69+
run: python -m pip install nox
70+
- name: Run samples
71+
run: nox -s _all_samples
72+
working-directory: samples
73+
74+
compliance_tests_14:
75+
runs-on: ubuntu-latest
76+
77+
services:
78+
emulator-0:
79+
image: gcr.io/cloud-spanner-emulator/emulator
80+
ports:
81+
- 9010:9010
82+
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v6
86+
- name: Setup Python
87+
uses: actions/setup-python@v6
88+
with:
89+
python-version: 3.9
90+
- name: Install nox
91+
run: python -m pip install nox
92+
- name: Run Compliance Tests
93+
run: nox -s compliance_test_14
94+
env:
95+
SPANNER_EMULATOR_HOST: localhost:9010
96+
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
97+
SQLALCHEMY_SILENCE_UBER_WARNING: 1
98+
99+
compliance_tests_20:
100+
runs-on: ubuntu-latest
101+
102+
services:
103+
emulator-0:
104+
image: gcr.io/cloud-spanner-emulator/emulator
105+
ports:
106+
- 9010:9010
107+
108+
steps:
109+
- name: Checkout code
110+
uses: actions/checkout@v6
111+
- name: Setup Python
112+
uses: actions/setup-python@v6
113+
with:
114+
python-version: 3.14
115+
- name: Install nox
116+
run: python -m pip install nox
117+
- name: Run Compliance Tests
118+
run: nox -s compliance_test_20
119+
env:
120+
SPANNER_EMULATOR_HOST: localhost:9010
121+
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
122+
123+
system:
124+
runs-on: ubuntu-latest
125+
strategy:
126+
matrix:
127+
python-version: ["3.9", "3.14"]
128+
services:
129+
emulator-0:
130+
image: gcr.io/cloud-spanner-emulator/emulator:latest
131+
ports:
132+
- 9010:9010
133+
134+
steps:
135+
- name: Checkout code
136+
uses: actions/checkout@v6
137+
- name: Setup Python ${{ matrix.python-version }}
138+
uses: actions/setup-python@v6
139+
with:
140+
python-version: ${{ matrix.python-version }}
141+
- name: Install nox
142+
run: python -m pip install nox
143+
- name: Run System Tests
144+
run: nox -s system-${{ matrix.python-version }}
145+
env:
146+
SPANNER_EMULATOR_HOST: localhost:9010
147+
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
148+
149+
migration_tests:
150+
runs-on: ubuntu-latest
151+
152+
services:
153+
emulator-0:
154+
image: gcr.io/cloud-spanner-emulator/emulator:latest
155+
ports:
156+
- 9010:9010
157+
158+
steps:
159+
- name: Checkout code
160+
uses: actions/checkout@v6
161+
- name: Setup Python
162+
uses: actions/setup-python@v6
163+
with:
164+
python-version: 3.9
165+
- name: Install nox
166+
run: python -m pip install nox
167+
- name: Run Migration Tests
168+
run: nox -s migration_test
169+
env:
170+
SPANNER_EMULATOR_HOST: localhost:9010
171+
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
*.py[cod]
2+
*.sw[op]
3+
4+
# C extensions
5+
*.so
6+
7+
# Packages
8+
*.egg
9+
*.egg-info
10+
dist
11+
build
12+
eggs
13+
.eggs
14+
parts
15+
bin
16+
var
17+
sdist
18+
develop-eggs
19+
.installed.cfg
20+
lib
21+
lib64
22+
__pycache__
23+
24+
# Installer logs
25+
pip-log.txt
26+
27+
# Unit test / coverage reports
28+
.coverage
29+
.nox
30+
.cache
31+
.pytest_cache
32+
33+
34+
# Mac
35+
.DS_Store
36+
37+
# JetBrains
38+
.idea
39+
40+
# VS Code
41+
.vscode
42+
43+
# emacs
44+
*~
45+
46+
# Built documentation
47+
docs/_build
48+
docs.metadata
49+
50+
# Virtual environment
51+
.venv/
52+
env/
53+
coverage.xml
54+
sponge_log.xml
55+
56+
# System test environment variables.
57+
system_tests/local_test_setup
58+
59+
# Make sure a generated file isn't accidentally committed.
60+
pylintrc
61+
pylintrc.test
62+
63+
test.cfg
64+
database
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# Copyright 2021 Google LLC
3+
#
4+
# Use of this source code is governed by a BSD-style
5+
# license that can be found in the LICENSE file or at
6+
# https://developers.google.com/open-source/licenses/bsd
7+
8+
set -eo pipefail
9+
10+
if [[ -z "${PROJECT_ROOT:-}" ]]; then
11+
PROJECT_ROOT="github/python-spanner-sqlalchemy"
12+
fi
13+
14+
cd "${PROJECT_ROOT}"
15+
16+
# Disable buffering, so that the logs stream through.
17+
export PYTHONUNBUFFERED=1
18+
19+
# Setup service account credentials.
20+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
21+
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
22+
export GOOGLE_CLOUD_PROJECT=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
23+
24+
python3 -m nox --version
25+
26+
# If this is a continuous build, send the test log to the FlakyBot.
27+
# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
28+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
29+
cleanup() {
30+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
31+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
32+
}
33+
trap cleanup EXIT HUP
34+
fi
35+
36+
# If NOX_SESSION is set, it only runs the specified session,
37+
# otherwise run all the sessions.
38+
if [[ -n "${NOX_SESSION:-}" ]]; then
39+
python3 -m nox -s ${NOX_SESSION:-}
40+
else
41+
python3 -m nox -s unit
42+
python3 -m nox -s system
43+
fi
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Download trampoline resources.
11+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12+
13+
# Download resources for system tests (service account key, etc.)
14+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python"
15+
16+
# Use the trampoline script to run in docker.
17+
build_file: "python-spanner-sqlalchemy/.kokoro/trampoline.sh"
18+
19+
# Configure the docker image for kokoro-trampoline.
20+
env_vars: {
21+
key: "TRAMPOLINE_IMAGE"
22+
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
23+
}
24+
env_vars: {
25+
key: "TRAMPOLINE_BUILD_FILE"
26+
value: "github/python-spanner-sqlalchemy/.kokoro/build.sh"
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Copyright 2021 Google LLC
3+
#
4+
# Use of this source code is governed by a BSD-style
5+
# license that can be found in the LICENSE file or at
6+
# https://developers.google.com/open-source/licenses/bsd
7+
8+
set -eo pipefail
9+
10+
function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
11+
function msg { println "$*" >&2 ;}
12+
function println { printf '%s\n' "$(now) $*" ;}
13+
14+
15+
# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
16+
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
17+
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
18+
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
19+
mkdir -p ${SECRET_LOCATION}
20+
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
21+
do
22+
msg "Retrieving secret ${key}"
23+
docker run --entrypoint=gcloud \
24+
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
25+
gcr.io/google.com/cloudsdktool/cloud-sdk \
26+
secrets versions access latest \
27+
--project cloud-devrel-kokoro-resources \
28+
--secret ${key} > \
29+
"${SECRET_LOCATION}/${key}"
30+
if [[ $? == 0 ]]; then
31+
msg "Secret written to ${SECRET_LOCATION}/${key}"
32+
else
33+
msg "Error retrieving secret ${key}"
34+
fi
35+
done

0 commit comments

Comments
 (0)