Skip to content

Commit

Permalink
Merge branch 'main' into async
Browse files Browse the repository at this point in the history
  • Loading branch information
PookieBuns authored Nov 20, 2023
2 parents fb60073 + b1c2f82 commit 3e9bfd8
Show file tree
Hide file tree
Showing 26 changed files with 818 additions and 514 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: python -m poetry install
- name: Lint
# Do not run on Python 3.7 as mypy behaves differently
if: matrix.python-version != '3.7'
run: python -m poetry run bash scripts/lint.sh
- run: mkdir coverage
- name: Test
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repos:
- --unsafe
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
args:
Expand Down
7 changes: 7 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

## Latest Changes

## 0.0.12

### Features

* ✨ Upgrade SQLAlchemy to 2.0. PR [#700](https://github.com/tiangolo/sqlmodel/pull/700) by [@tiangolo](https://github.com/tiangolo) including initial work in PR [#563](https://github.com/tiangolo/sqlmodel/pull/563) by [@farahats9](https://github.com/farahats9).

### Internal

*[pre-commit.ci] pre-commit autoupdate. PR [#686](https://github.com/tiangolo/sqlmodel/pull/686) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* 👷 Upgrade latest-changes GitHub Action. PR [#693](https://github.com/tiangolo/sqlmodel/pull/693) by [@tiangolo](https://github.com/tiangolo).

## 0.0.11
Expand Down
13 changes: 9 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.7"
SQLAlchemy = ">=1.4.36,<2.0.0"
SQLAlchemy = ">=2.0.0,<2.1.0"
pydantic = "^1.9.0"
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}

[tool.poetry.group.dev.dependencies]
pytest = "^7.0.1"
Expand All @@ -45,9 +44,9 @@ pillow = "^9.3.0"
cairosvg = "^2.5.2"
mdx-include = "^1.4.1"
coverage = {extras = ["toml"], version = ">=6.2,<8.0"}
fastapi = "^0.68.1"
requests = "^2.26.0"
fastapi = "^0.103.2"
ruff = "^0.1.2"
httpx = "0.24.1"
testcontainers = "^3.7.1"
psycopg2-binary = "^2.9.7"
asyncpg = "^0.28.0"
Expand Down Expand Up @@ -83,6 +82,12 @@ strict = true
module = "sqlmodel.sql.expression"
warn_unused_ignores = false

[[tool.mypy.overrides]]
module = "docs_src.*"
disallow_incomplete_defs = false
disallow_untyped_defs = false
disallow_untyped_calls = false

[tool.ruff]
select = [
"E", # pycodestyle errors
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class Arg(BaseModel):
arg = Arg(name=f"entity_{i}", annotation=t_var)
ret_type = t_var
else:
t_type = f"_TModel_{i}"
t_var = f"Type[{t_type}]"
arg = Arg(name=f"entity_{i}", annotation=t_var)
t_type = f"_T{i}"
t_var = f"_TCCA[{t_type}]"
arg = Arg(name=f"__ent{i}", annotation=t_var)
ret_type = t_type
args.append(arg)
return_types.append(ret_type)
Expand Down
55 changes: 31 additions & 24 deletions sqlmodel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
__version__ = "0.0.11"
__version__ = "0.0.12"

# Re-export from SQLAlchemy
from sqlalchemy.engine import create_engine as create_engine
from sqlalchemy.engine import create_mock_engine as create_mock_engine
from sqlalchemy.engine import engine_from_config as engine_from_config
from sqlalchemy.inspection import inspect as inspect
from sqlalchemy.pool import QueuePool as QueuePool
from sqlalchemy.pool import StaticPool as StaticPool
from sqlalchemy.schema import BLANK_SCHEMA as BLANK_SCHEMA
from sqlalchemy.schema import DDL as DDL
from sqlalchemy.schema import CheckConstraint as CheckConstraint
Expand All @@ -21,7 +24,6 @@
from sqlalchemy.schema import PrimaryKeyConstraint as PrimaryKeyConstraint
from sqlalchemy.schema import Sequence as Sequence
from sqlalchemy.schema import Table as Table
from sqlalchemy.schema import ThreadLocalMetaData as ThreadLocalMetaData
from sqlalchemy.schema import UniqueConstraint as UniqueConstraint
from sqlalchemy.sql import LABEL_STYLE_DEFAULT as LABEL_STYLE_DEFAULT
from sqlalchemy.sql import (
Expand All @@ -32,26 +34,14 @@
LABEL_STYLE_TABLENAME_PLUS_COL as LABEL_STYLE_TABLENAME_PLUS_COL,
)
from sqlalchemy.sql import alias as alias
from sqlalchemy.sql import all_ as all_
from sqlalchemy.sql import and_ as and_
from sqlalchemy.sql import any_ as any_
from sqlalchemy.sql import asc as asc
from sqlalchemy.sql import between as between
from sqlalchemy.sql import bindparam as bindparam
from sqlalchemy.sql import case as case
from sqlalchemy.sql import cast as cast
from sqlalchemy.sql import collate as collate
from sqlalchemy.sql import column as column
from sqlalchemy.sql import delete as delete
from sqlalchemy.sql import desc as desc
from sqlalchemy.sql import distinct as distinct
from sqlalchemy.sql import except_ as except_
from sqlalchemy.sql import except_all as except_all
from sqlalchemy.sql import exists as exists
from sqlalchemy.sql import extract as extract
from sqlalchemy.sql import false as false
from sqlalchemy.sql import func as func
from sqlalchemy.sql import funcfilter as funcfilter
from sqlalchemy.sql import insert as insert
from sqlalchemy.sql import intersect as intersect
from sqlalchemy.sql import intersect_all as intersect_all
Expand All @@ -61,28 +51,19 @@
from sqlalchemy.sql import literal as literal
from sqlalchemy.sql import literal_column as literal_column
from sqlalchemy.sql import modifier as modifier
from sqlalchemy.sql import not_ as not_
from sqlalchemy.sql import null as null
from sqlalchemy.sql import nulls_first as nulls_first
from sqlalchemy.sql import nulls_last as nulls_last
from sqlalchemy.sql import nullsfirst as nullsfirst
from sqlalchemy.sql import nullslast as nullslast
from sqlalchemy.sql import or_ as or_
from sqlalchemy.sql import outerjoin as outerjoin
from sqlalchemy.sql import outparam as outparam
from sqlalchemy.sql import over as over
from sqlalchemy.sql import subquery as subquery
from sqlalchemy.sql import table as table
from sqlalchemy.sql import tablesample as tablesample
from sqlalchemy.sql import text as text
from sqlalchemy.sql import true as true
from sqlalchemy.sql import tuple_ as tuple_
from sqlalchemy.sql import type_coerce as type_coerce
from sqlalchemy.sql import union as union
from sqlalchemy.sql import union_all as union_all
from sqlalchemy.sql import update as update
from sqlalchemy.sql import values as values
from sqlalchemy.sql import within_group as within_group
from sqlalchemy.types import ARRAY as ARRAY
from sqlalchemy.types import BIGINT as BIGINT
from sqlalchemy.types import BINARY as BINARY
Expand All @@ -93,6 +74,8 @@
from sqlalchemy.types import DATE as DATE
from sqlalchemy.types import DATETIME as DATETIME
from sqlalchemy.types import DECIMAL as DECIMAL
from sqlalchemy.types import DOUBLE as DOUBLE
from sqlalchemy.types import DOUBLE_PRECISION as DOUBLE_PRECISION
from sqlalchemy.types import FLOAT as FLOAT
from sqlalchemy.types import INT as INT
from sqlalchemy.types import INTEGER as INTEGER
Expand All @@ -105,12 +88,14 @@
from sqlalchemy.types import TEXT as TEXT
from sqlalchemy.types import TIME as TIME
from sqlalchemy.types import TIMESTAMP as TIMESTAMP
from sqlalchemy.types import UUID as UUID
from sqlalchemy.types import VARBINARY as VARBINARY
from sqlalchemy.types import VARCHAR as VARCHAR
from sqlalchemy.types import BigInteger as BigInteger
from sqlalchemy.types import Boolean as Boolean
from sqlalchemy.types import Date as Date
from sqlalchemy.types import DateTime as DateTime
from sqlalchemy.types import Double as Double
from sqlalchemy.types import Enum as Enum
from sqlalchemy.types import Float as Float
from sqlalchemy.types import Integer as Integer
Expand All @@ -122,16 +107,38 @@
from sqlalchemy.types import String as String
from sqlalchemy.types import Text as Text
from sqlalchemy.types import Time as Time
from sqlalchemy.types import TupleType as TupleType
from sqlalchemy.types import TypeDecorator as TypeDecorator
from sqlalchemy.types import Unicode as Unicode
from sqlalchemy.types import UnicodeText as UnicodeText
from sqlalchemy.types import Uuid as Uuid

# From SQLModel, modifications of SQLAlchemy or equivalents of Pydantic
from .engine.create import create_engine as create_engine
from .main import Field as Field
from .main import Relationship as Relationship
from .main import SQLModel as SQLModel
from .orm.session import Session as Session
from .sql.expression import all_ as all_
from .sql.expression import and_ as and_
from .sql.expression import any_ as any_
from .sql.expression import asc as asc
from .sql.expression import between as between
from .sql.expression import case as case
from .sql.expression import cast as cast
from .sql.expression import col as col
from .sql.expression import collate as collate
from .sql.expression import desc as desc
from .sql.expression import distinct as distinct
from .sql.expression import extract as extract
from .sql.expression import funcfilter as funcfilter
from .sql.expression import not_ as not_
from .sql.expression import nulls_first as nulls_first
from .sql.expression import nulls_last as nulls_last
from .sql.expression import or_ as or_
from .sql.expression import over as over
from .sql.expression import select as select
from .sql.expression import tuple_ as tuple_
from .sql.expression import type_coerce as type_coerce
from .sql.expression import within_group as within_group
from .sql.sqltypes import GUID as GUID
from .sql.sqltypes import AutoString as AutoString
Empty file removed sqlmodel/engine/__init__.py
Empty file.
139 changes: 0 additions & 139 deletions sqlmodel/engine/create.py

This file was deleted.

Loading

0 comments on commit 3e9bfd8

Please sign in to comment.