Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: support schemas in queries and dml statements #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2025

Conversation

waltaskew
Copy link
Contributor

@waltaskew waltaskew commented Apr 22, 2025

Add support for SELECT, UPDATE and DELETE statements against tables in
schemas.

Schema names are not allowed in Spanner SELECT statements. We need to
avoid generating SQL like

SELECT schema.tbl.id
FROM schema.tbl

To do so, we alias the table in order to produce SQL like:

SELECT tbl_1.id, tbl_1.col
FROM schema.tbl AS tbl_1

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Apr 22, 2025
@waltaskew waltaskew force-pushed the support-named-schemas branch from 35bfd71 to 5f851b8 Compare April 22, 2025 00:36
@waltaskew waltaskew mentioned this pull request Apr 22, 2025
@waltaskew waltaskew force-pushed the support-named-schemas branch from 5f851b8 to 830109d Compare April 29, 2025 22:58
Add support for SELECT, UPDATE and DELETE statements against tables in
schemas.

Schema names are not allowed in Spanner SELECT statements. We need to
avoid generating SQL like

```sql
SELECT schema.tbl.id
FROM schema.tbl
```

To do so, we alias the table in order to produce SQL like:

```sql
SELECT tbl_1.id, tbl_1.col
FROM schema.tbl AS tbl_1
```
@waltaskew waltaskew force-pushed the support-named-schemas branch from 830109d to d947102 Compare April 29, 2025 23:06
@waltaskew waltaskew marked this pull request as ready for review April 29, 2025 23:07
@waltaskew waltaskew changed the title Support Named Schemas Support Named Schemas in Queries Apr 29, 2025
@waltaskew waltaskew force-pushed the support-named-schemas branch 4 times, most recently from d7c7506 to 9ddee8b Compare May 1, 2025 22:24
In sqlalchemy 2.0, it's:
```python
self._label_select_column(None, c, True, False, {}, include_table=False)
```

In older versions, it's
```python
self._label_select_column(None, c, True, False, {'include_table': False})
```

So instead, forward a flag to `vist_column` which can set this kwarg
safely itself.
@waltaskew waltaskew force-pushed the support-named-schemas branch from 9ddee8b to 2638b77 Compare May 1, 2025 22:32
@olavloite olavloite changed the title Support Named Schemas in Queries feat: support schemas in queries and dml statements May 2, 2025
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 2, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 2, 2025
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 2, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 2, 2025
@olavloite olavloite merged commit 81c154a into googleapis:main May 2, 2025
14 checks passed
@olavloite
Copy link
Contributor

@waltaskew Thank you for this great contribution!

@waltaskew
Copy link
Contributor Author

@waltaskew Thank you for this great contribution!

Thanks for reviewing and accepting! Do you have any plans around when the next release of the library will be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.