Live data from Hacker News

SQLAlchemy 2.0 Released

sqlalchemy.org

41–50 of 84 posts

Re: SQLAlchemy 2.0 Released

#42
Wall of text.

Less is more.

Non-blocking I/O is wonderful news though, especially for high throughput yet high latency internet native databases such CockroachDB.

Re: SQLAlchemy 2.0 Released

#43
post #7

I was just working on sqlalchemy. zzzeek's help if you get stuck somewhere is outstanding. Async is a godsent feature for us.

Out of curiosity, what's the benefit of async for you?

Non-blocking I/O is essential for high throughput, but high latency internet native databases such CockroachDB.

Re: SQLAlchemy 2.0 Released

#44
post #19

I would urge people who have had issues with the documentation to give the 2.0 documentation a try. Many aspects of it have been completely rewritten, both to correctly describe things in terms of the new APIs as well as to modernize a lot of old documentation that was written many years ago. First off, SQLAlchemy's docs are pretty easy to get to, for a direct link just go to: https://docs.sqlalchemy.org/ It's an eso…

So confused after reading unified tutorial. It's so confusing and too many styles to declare ORM

>>> class User(Base): ... __tablename__ = "user_account" ... ... id: Mapped[int] = mapped_column(primary_key=True) ... name: Mapped[str] = mapped_column(String(30)) ... fullname: Mapped[Optional[str]] ... ... addresses: Mapped[List["Address"]] = relationship(back_populates="user") ... ... def __repr__(self) -> str: ... return f"User(id={self.id!r}, name={self.name!r},

VS

class User(Base): __tablename__ = "user_account"

    id = mapped_column(Integer, primary_key=True)
    name = mapped_column(String(30), nullable=False)
    fullname = mapped_column(String)

    addresses = relationship("Address", back_populates="user")

    # ... definition continues

Vs

user_table = Table( "user", mapper_registry.metadata, Column("id", Integer, primary_key=True), Column("name", String(50)), Column("fullname", String(50)), Column("nickname", String(12)), )

Vs

class Customers(Base): __tablename__ = 'customers'

   id = Column(Integer, primary_key = True)
   name = Column(String)
   address = Column(String)
   email = Column(String)
Why so many styles? Why can't be like pydantic or Django and use just one style for ORM?

it's breaking zen of python, it makes searching examples on Google very hard ( esp with Google getting really crappy)

Re: SQLAlchemy 2.0 Released

#45
post #10
post #6

Sorry for detracting from the release news but SQLAlchemy has to have the least helpful website of any major library I can think of. I'm trying to find basic 101 code examples and it's just one wall of text after another. I found how to cite SQLAlchemy in a research paper and have yet to find a single code example.

Check out pugsql, we switched from SQLAlchemy to that because the former was overkill, and way too complex.

It's unmaintained..

Re: SQLAlchemy 2.0 Released

#46
post #39

Earlier quoted context omitted.

I find ORM models useful for type checking and migrations, what is your experience for this with pugsql?

At the risk of sounding flippant (which I promise is not the intention), if I care about type safety I don’t use python.

Why? Python 3.8+ have perfect typing

Re: SQLAlchemy 2.0 Released

#47
post #6

Sorry for detracting from the release news but SQLAlchemy has to have the least helpful website of any major library I can think of. I'm trying to find basic 101 code examples and it's just one wall of text after another. I found how to cite SQLAlchemy in a research paper and have yet to find a single code example.

Yes, that's probably my biggest complaint about the library. The docs are there but hard to navigate. Sometimes crucial tips are buried in an aside on one of the many pages that talk about the same topic. It's difficult to get started and it's also difficult to find the ultimate explanation of what's going on.

Too much repetition in docs . The framework might be good but the doc is lacking simplicity. I still can't get a grasp of what going on while reading.

Re: SQLAlchemy 2.0 Released

#48
post #34

For a decade I avoided sqlalchemy, we finally got to use it last year and found it quite overwhelmingly complex and 1.4 documentation is messy. We had to use mixed styles. I checked unified doc and it had improved but , still wall of texts.. quite hard to read. Readability count's.

What do you use instead?

Now we're using Django for current project. But for new project we planned to use Starlite framework so we are still deciding 1. PicoloORM 2. Sqlalchemy 2.x

And now finding sqlalchemy 2.0 still way too complicated

Re: SQLAlchemy 2.0 Released

#49
I would request an experience sqla developer to write a blog post, tutorial or even a paid course for new sqla, doing general queries and necessary db operation, using 2.0 specific, best ORM way of doing things ( only one ORM style).

And it should become default go-to doc for every new comers

Re: SQLAlchemy 2.0 Released

#50
post #44
post #19

I would urge people who have had issues with the documentation to give the 2.0 documentation a try. Many aspects of it have been completely rewritten, both to correctly describe things in terms of the new APIs as well as to modernize a lot of old documentation that was written many years ago. First off, SQLAlchemy's docs are pretty easy to get to, for a direct link just go to: https://docs.sqlalchemy.org/ It's an eso…

So confused after reading unified tutorial. It's so confusing and too many styles to declare ORM >>> class User(Base): ... __tablename__ = "user_account" ... ... id: Mapped[int] = mapped_column(primary_key=True) ... name: Mapped[str] = mapped_column(String(30)) ... fullname: Mapped[Optional[str]] ... ... addresses: Mapped[List["Address"]] = relationship(back_populates="user") ... ... def __repr__(self) -> str: ... re…

> Why can't be like pydantic

Pydantic also has multiple styles, in fact, I think it has more styles than SQLAlchemy.

> and use just one style for ORM?

To be fair, one of the “styles” you show is not ORM, its the lower-level Core which can be used without the ORM and which the ORM is built on top of. And the two ORM styles include an older one largely for backward compatibility and a more modern one.

Post reply on HN