as I dont have a windows machine to test I don't really know
how to get a millisecond-accurate timer for windows,
Python documentation claimed time.monotonic() did this however
the continued failure of test_reconnect indicates this is not the case
and that the timer is still bumping up by multi-millisecond
granularity. force a delay instead.
Change-Id: I237b223eabc55c1d47ecece13873be1f7be20e47
The internal clock used by the :class:`_pool.Pool` object is now
time.monotonic_time() under Python 3. Under Python 2, time.time() is still
used, which is legacy. This clock is used to measure the age of a
connection against its starttime, and used in comparisons against the
pool_timeout setting as well as the last time the pool was marked as
invalid to determine if the connection should be recycled. Previously,
time.time() was used which was subject to inaccuracies as a result of
system clock changes as well as poor time resolution on windows.
Change-Id: I94f90044c1809508e26a5a00134981c2a00d0405
this test can't require "skip identity_columns" because
older Postgresql and Oracle report false for "identity_columns",
but their dialects won't skip actually rendering.
for now the only option is to hardcode to a non-identity
dialect.
Change-Id: Ia4f39f393b4ba10b3e82601a22ab75200cd52909
this provides a front-end option to disable tests marked
as timing_intensive, all of which are in test_pool, which are more
fragile and aren't consistent on the
github runners. also remove /reduce unnecessary time.sleep()
from two other pool tests that are not timing intensive.
note that this removes test_hanging_connect_within_overflow
from the github runs via the timing_intensive requirement.
I've also removed MockReconnectTest from exclusions as those are
really important tests and they use mocks so should not have
platform dependent issues. Need to see what the
windows failures are.
Closes: #5633
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5633
Pull-request-sha: 166833e16e
Change-Id: Icb3d284a2a952e2495d80fa91e22e0b32a54340f
Fixed bug where a call ``InstanceState.obj()`` could return None when
synchronizing the instance states of the objects in the session in case
they become out of scope but are not yet finalized by the gc. This
case does not happen in cPython, but it may present itself in pypy.
The approach is to allow None to be gracefully handled by the
evaluator itself, ensuring it returns None in all cases when None
is passed in.
Fixes: #5631
Change-Id: I53d38fbea2e72b2e677c6e7f70bf075a58e58945
this test was not actually working correctly against
mariadb and was "failing" (i.e. "passing") inappropriately
for pymysql, mysqlclient. it also started "passing" (i.e. "failing")
for mariadb as of 1.0.3.
modernize reqs here including for mssql bit behavior.
Change-Id: Ia88ee607ec8d59f6140a7e4a1174910382d53674
Repaired a function-level import that was not using SQLAlchemy's standard
late-import system within the sqlalchemy.exc module.
Moved preloaded to sqlalchemy.util.preloaded so that it
does not depend on langhelpers which depends on exc.
Fixes: #5632
Change-Id: I61b7ce9cd461071ce543714739f67aa5aeb47fd6
Change how pypy is detected. From I0952e54ed9af2952ea340be1945311376ffc1ad2
Fix typos. From Ibb5871a457c0555f82b37e354e7787d15575f1f7
Change-Id: I9657e602267590f10a74df27a84e4292da94c30a
Add support to ``FETCH {FIRST | NEXT} [ count ] {ROW | ROWS}
{ONLY | WITH TIES}`` in the select for the supported backends,
currently PostgreSQL, Oracle and MSSQL.
Fixes: #5576
Change-Id: Ibb5871a457c0555f82b37e354e7787d15575f1f7
Fixed bug where an error was not raised for lower-case
:func:`_column` added to lower-case :func:`_table` object. This now raises
:class:`_exc.ArgumentError` which has always been the case for
upper-case :class:`_schema.Column` and :class:`_schema.Table`.
Fixes: #5618
Change-Id: Ifcbdf27c022fd2996a5b99559df71fc1c1e0f19c
Fixed bug where an UPDATE statement against a JOIN using MySQL multi-table
format would fail to include the table prefix for the target table if the
statement had no WHERE clause, as only the WHERE clause were scanned to
detect a "multi table update" at that particular point. The target
is now also scanned if it's a JOIN to get the leftmost table as the
primary table and the additional entries as additional FROM entries.
Fixes: #5617
Change-Id: I26d74afebe06e28af28acf960258f170a1627823
a recent rerun of profiles added more profiling data that's
failing over small differences. 15% variance is fine for these
tests that are looking for thousands of encode calls.
Change-Id: I33dac346b2ff07f86b4bc278a7309ca9b7efbaab
Added support for reflecting "identity" columns, which are now returned
as part of the structure returned by :meth:`_reflection.Inspector.get_columns`.
When reflecting full :class:`_schema.Table` objects, identity columns will
be represented using the :class:`_schema.Identity` construct.
Fixed compilation error on oracle for sequence and identity column
``nominvalue`` and ``nomaxvalue`` options that require no space in them.
Improved test compatibility with oracle 18.
As part of the support for reflecting :class:`_schema.Identity` objects,
the method :meth:`_reflection.Inspector.get_columns` no longer returns
``mssql_identity_start`` and ``mssql_identity_increment`` as part of the
``dialect_options``. Use the information in the ``identity`` key instead.
The mssql dialect will assume that at least MSSQL 2005 is used.
There is no hard exception raised if a previous version is detected,
but operations may fail for older versions.
Fixes: #5527Fixes: #5324
Change-Id: If039fe637c46b424499e6bac54a2cbc0dc54cb57
It's better, the majority of these changes look more readable to me.
also found some docstrings that had formatting / quoting issues.
Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
The :meth:`_sql.Join.alias` method is deprecated and will be removed in
SQLAlchemy 2.0. An explicit select + subquery, or aliasing of the inner
tables, should be used instead.
Fixes: #5010
Change-Id: Ic913afc31f0d70b0605f9a7af2742a0de1f9ad19
since 450f5c0d65 we've been seeing
errors during the uninstrument_class event where first
we saw an internal weakref being collected earlier than seen,
then fixing that we saw the listener collection changing during
iteration for similar reasons.
we would assume the issue is because of the interaction between
mapper / instrumentation/ registry during a test teardown
and the usage of the uninstrument_class event within this
interaction. this interaction is too fundamental to be
relying upon this event in any case and when I wrote this
new code i was planning on changing that part in any case,
I just forgot.
Change-Id: I15744e01bb4d3349bfd529593ebd23eae658eaab
the ORMSelectCompileState was trying to get away with
not building out the "froms" list of the state, but we need
this for select.froms. Build this out and add some tests
for select(), including some other state-oriented use cases.
Fixes: #5614
Change-Id: I29ca200f292cbae87c722bc97a89d7c453d7d27a
With pytest 6.1.0 the root directory calculation logic has
changed and is unreliable on our jenkins setup. make
sure this is set explicitly.
Change-Id: I1d48b887030c32d2f3361fc36e65e8a988d2ba81
References: https://github.com/pytest-dev/pytest/issues/7807
the change in 1e80028550 failed to fully
remove the "future" symbol which then got confused against the
import of the "future" package itself, which is also not needed.
remove it entirely.
pin pytest < 6.1 to see if new error condition may be avoided
Change-Id: Ibe45040120d3772c39faef4a61ed26f90b60c79e
Improved declarative inheritance scanning to not get tripped up when the
same base class appears multiple times in the base inheritance list.
Fixes: #4699
Change-Id: I932e735cd2e2c1efa935936c84219924225d10f1
This WIP is part of the final push for 1.4's docs
to fully "2.0-ize" what we can, and have it all ready.
So far this includes a rewrite of the 2.0 migration,
set up for the 1.4 /2.0 docs style, and a total redesign
of the index page using a new flex layout in zzzeeksphinx.
It also reworks some of the API reference sections
to have more subheaders. zzzeeksphinx is also enhanced
to provide automatic summaries for all api doc section.
Change-Id: I01d360cb9c8749520246b96ee6496143c6037918
Set default type codec for ``json`` and ``jsonb`` types when using
the asyncpg driver. By default asyncpg will not decode them and return
strings instead.
Fixes: #5584
Change-Id: I41348eff8096ccf87b952d7e797c0694c6c4b5c4
This will mark an issue with the "stale" label after
5 days and close after 7.
The goal is that it will mark "question" issues as stale
automatically.
it doesn't give us a way to link it to that label however,
and we have to define it in terms of labels to exclude.
Change-Id: I7c34f4e8fdf4ee0a15baa93b5831e5cdcf72dcc8
Provide support for multiple hosts in the PostgreSQL connection string.
A user requested for SQLAlchemy to support multiple hosts within a PostgreSQL URL string. The proposed fix allows this. In the event that the url contains multiple hosts the proposed code will convert the query["hosts"] tuple into a single string. This allows the hosts to then get converted into a valid dsn variable in the psycopg2 connect function.
This pull request is:
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [X ] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.
**Have a nice day!**
Fixes: #4392Closes: #5554
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5554
Pull-request-sha: 3f7a0ab8df
Change-Id: I3f3768d51b8331de786ffdc025b7ecfc662eafe5
The "slice index" feature used by :class:`_orm.Query` as well as by the
dynamic relationship loader will no longer accept negative indexes in
SQLAlchemy 2.0. These operations do not work efficiently and load the
entire collection in, which is both surprising and undesirable. These
will warn in 1.4 unless the :paramref:`_orm.Session.future` flag is set in
which case they will raise IndexError.
Fixes: #5606
Change-Id: I5f5dcf984a8f41ab3d0e233ef7553e77fd99a771
CI is showing that this listener may be triggered
when the target, a mapped class, has been garbage collected.
I'm not able to reproduce this locally.
Change-Id: Iad96c088a9a3dc28c4bcd716e293c03d3b312efd