Skip to content
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

Install more shared django_apps #1001

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Swatinem
Copy link
Contributor

This pulls in the following newly moved to shared.django_apps: compare, labelanalysis, profiling and staticanalysis


Depends on codecov/shared#469

This pulls in the following newly moved to `shared.django_apps`: `compare`, `labelanalysis`, `profiling` and `staticanalysis`
@Swatinem Swatinem requested review from adrian-codecov and a team January 10, 2025 12:27
@Swatinem Swatinem self-assigned this Jan 10, 2025
Copy link

This PR includes changes to shared. Please review them here: codecov/shared@609e56d...c1c9cb2

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.74%. Comparing base (78ce991) to head (4ce731d).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1001   +/-   ##
=======================================
  Coverage   97.74%   97.74%           
=======================================
  Files         454      454           
  Lines       36368    36371    +3     
=======================================
+ Hits        35548    35551    +3     
  Misses        820      820           
Flag Coverage Δ
integration 42.02% <100.00%> (+<0.01%) ⬆️
unit 90.46% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

⚠️ Impact Analysis from Codecov is deprecated and will be sunset on Jan 31 2025. See more

@codecov-staging
Copy link

codecov-staging bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Jan 10, 2025

❌ 21 Tests Failed:

Tests completed Failed Passed Skipped
1774 21 1753 4
View the top 3 failed tests by shortest run time
tasks/tests/unit/test_profiling_collection.py::TestProfilingCollectionTask::test_find_uploads_to_join_already_joined
Stack Traces | 0.031s run time
self = <sqlalchemy.engine.base.Connection object at 0x7ff4d7689190>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7ff4d635f240>, [{'normalized_at': datetime.d..., tzinfo=datetime.timezone.utc), 'normalized_location': None, 'profiling_commit_id': 19, 'raw_upload_location': None}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7ff4d5c80b50>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4f48d5e40; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (9, 0ea822d8-5893-457a-9851-3907d9674404, 2025-01-10 12:35:23.104998+00, 2025-01-10 12:35:23.105003+00, null, 19, 2021-05-01 01:01:01+00, null).

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_profiling_collection.TestProfilingCollectionTask object at 0x7ff504596050>
dbsession = <sqlalchemy.orm.session.Session object at 0x7ff4f48d5b80>

    def test_find_uploads_to_join_already_joined(self, dbsession):
        before = datetime(2021, 5, 1, 4, 0, 0).replace(tzinfo=timezone.utc)
        task = ProfilingCollectionTask()
        pcf = ProfilingCommitFactory.create(
            last_joined_uploads_at=datetime(2021, 5, 1, 1, 2, 3)
        )
        dbsession.add(pcf)
        dbsession.flush()
        first_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 1, 1, 1).replace(tzinfo=timezone.utc),
        )
        second_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 1, 30, 0).replace(tzinfo=timezone.utc),
        )
        third_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 2, 1, 0).replace(tzinfo=timezone.utc),
        )
        fourth_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 4, 12, 14).replace(tzinfo=timezone.utc),
        )
        dbsession.add(first_pu)
        dbsession.add(second_pu)
        dbsession.add(third_pu)
        dbsession.add(fourth_pu)
>       res, when = task.find_uploads_to_join(pcf, before)

.../tests/unit/test_profiling_collection.py:570: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.13.../statsd/client/timer.py:38: in _wrapped
    return f(*args, **kwargs)
tasks/profiling_collection.py:105: in find_uploads_to_join
    .first()
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3429: in first
    ret = list(self[0:1])
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3203: in __getitem__
    return list(res)
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3534: in __iter__
    self.session._autoflush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1633: in _autoflush
    util.raise_(e, with_traceback=sys.exc_info()[2])
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1622: in _autoflush
    self.flush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.13.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4f48d5e40; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
E       (psycopg2.errors.NotNullViolation) null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (9, 0ea822d8-5893-457a-9851-3907d9674404, 2025-01-10 12:35:23.104998+00, 2025-01-10 12:35:23.105003+00, null, 19, 2021-05-01 01:01:01+00, null).
E       
E       [SQL: INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id, normalized_at, normalized_location) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(raw_upload_location)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id]
E       [parameters: {'external_id': UUID('0ea822d8-5893-457a-9851-3907d9674404'), 'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 105003, tzinfo=datetime.timezone.utc), 'raw_upload_location': None, 'profiling_commit_id': 19, 'normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: IntegrityError
tasks/tests/unit/test_profiling_collection.py::TestProfilingCollectionTask::test_find_uploads_to_join_first_joining
Stack Traces | 0.034s run time
self = <sqlalchemy.engine.base.Connection object at 0x7ff4f4313710>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 22, 796304, tzinfo=datetime.timezone.utc), 'external_id': UUID('...rmalized_at': datetime.datetime(2021, 5, 1, 0, 12, 14, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7ff4d635f240>, [{'normalized_at': datetime.d..., tzinfo=datetime.timezone.utc), 'normalized_location': None, 'profiling_commit_id': 17, 'raw_upload_location': None}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7ff4d7497dd0>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd61c410>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4fd61d990; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 22, 796304, tzinfo=datetime.timezone.utc), 'external_id': UUID('...rmalized_at': datetime.datetime(2021, 5, 1, 0, 12, 14, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd61c410>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (8, 0ec1bf11-c302-4d9e-8f18-3d8e5c25b08f, 2025-01-10 12:35:22.796304+00, 2025-01-10 12:35:22.796309+00, null, 17, 2021-05-01 00:12:14+00, null).

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_profiling_collection.TestProfilingCollectionTask object at 0x7ff5045e67a0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7ff4fd61e990>

    def test_find_uploads_to_join_first_joining(self, dbsession):
        before = datetime(2021, 5, 2, 0, 3, 4).replace(tzinfo=timezone.utc)
        task = ProfilingCollectionTask()
        pcf = ProfilingCommitFactory.create()
        another_pfc = ProfilingCommitFactory.create()
        dbsession.add(pcf)
        dbsession.add(another_pfc)
        dbsession.flush()
        first_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 0, 12, 14).replace(tzinfo=timezone.utc),
        )
        second_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 6, 10, 0, 12, 14).replace(tzinfo=timezone.utc),
        )
        dbsession.add(first_pu)
        dbsession.add(second_pu)
>       res, when = task.find_uploads_to_join(pcf, before)

.../tests/unit/test_profiling_collection.py:534: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.13.../statsd/client/timer.py:38: in _wrapped
    return f(*args, **kwargs)
tasks/profiling_collection.py:105: in find_uploads_to_join
    .first()
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3429: in first
    ret = list(self[0:1])
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3203: in __getitem__
    return list(res)
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3534: in __iter__
    self.session._autoflush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1633: in _autoflush
    util.raise_(e, with_traceback=sys.exc_info()[2])
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1622: in _autoflush
    self.flush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.13.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4fd61d990; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 22, 796304, tzinfo=datetime.timezone.utc), 'external_id': UUID('...rmalized_at': datetime.datetime(2021, 5, 1, 0, 12, 14, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd61c410>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
E       (psycopg2.errors.NotNullViolation) null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (8, 0ec1bf11-c302-4d9e-8f18-3d8e5c25b08f, 2025-01-10 12:35:22.796304+00, 2025-01-10 12:35:22.796309+00, null, 17, 2021-05-01 00:12:14+00, null).
E       
E       [SQL: INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id, normalized_at, normalized_location) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(raw_upload_location)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id]
E       [parameters: {'external_id': UUID('0ec1bf11-c302-4d9e-8f18-3d8e5c25b08f'), 'created_at': datetime.datetime(2025, 1, 10, 12, 35, 22, 796304, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2025, 1, 10, 12, 35, 22, 796309, tzinfo=datetime.timezone.utc), 'raw_upload_location': None, 'profiling_commit_id': 17, 'normalized_at': datetime.datetime(2021, 5, 1, 0, 12, 14, tzinfo=datetime.timezone.utc), 'normalized_location': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: IntegrityError
tests/unit/test_task_router.py::test_get_user_plan_from_profiling_upload
Stack Traces | 0.034s run time
self = <sqlalchemy.engine.base.Connection object at 0x7ff4f4313710>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 33, 788596, tzinfo=datetime.timezone.utc), 'external_id': UUID('a7b18c37-c242-4445-a0e8-26005b187537'), 'normalized_at': None, 'normalized_location': None, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7ff4d635f240>, [{'normalized_at': None, 'normalized_location': None, 'profiling_commit_id': 26, 'raw_upload_location': None}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7ff4d715c350>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd67c5f0>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4fd67f010; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 33, 788596, tzinfo=datetime.timezone.utc), 'external_id': UUID('a7b18c37-c242-4445-a0e8-26005b187537'), 'normalized_at': None, 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd67c5f0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (12, a7b18c37-c242-4445-a0e8-26005b187537, 2025-01-10 12:35:33.788596+00, 2025-01-10 12:35:33.788602+00, null, 26, null, null).

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

dbsession = <sqlalchemy.orm.session.Session object at 0x7ff4fd67c230>
fake_profiling_commit = (<database.models.profiling.ProfilingCommit object at 0x7ff4d58078b0>, <database.models.profiling.ProfilingCommit object at 0x7ff4d5807ac0>)

    @pytest.fixture
    def fake_profiling_commit_upload(dbsession, fake_profiling_commit):
        (profiling_commit, profiling_commit_enterprise) = fake_profiling_commit
    
        profiling_upload = ProfilingUploadFactory(profiling_commit=profiling_commit)
        profiling_upload_enterprise = ProfilingUploadFactory(
            profiling_commit=profiling_commit_enterprise
        )
        dbsession.add(profiling_upload)
        dbsession.add(profiling_upload_enterprise)
>       dbsession.flush()

tests/unit/test_task_router.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.13.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4fd67f010; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 33, 788596, tzinfo=datetime.timezone.utc), 'external_id': UUID('a7b18c37-c242-4445-a0e8-26005b187537'), 'normalized_at': None, 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4fd67c5f0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (12, a7b18c37-c242-4445-a0e8-26005b187537, 2025-01-10 12:35:33.788596+00, 2025-01-10 12:35:33.788602+00, null, 26, null, null).
E       
E       [SQL: INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id, normalized_at, normalized_location) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(raw_upload_location)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id]
E       [parameters: {'external_id': UUID('a7b18c37-c242-4445-a0e8-26005b187537'), 'created_at': datetime.datetime(2025, 1, 10, 12, 35, 33, 788596, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2025, 1, 10, 12, 35, 33, 788602, tzinfo=datetime.timezone.utc), 'raw_upload_location': None, 'profiling_commit_id': 26, 'normalized_at': None, 'normalized_location': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: IntegrityError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ 21 Tests Failed:

Tests completed Failed Passed Skipped
1774 21 1753 4
View the top 3 failed tests by shortest run time
tasks/tests/unit/test_profiling_collection.py::TestProfilingCollectionTask::test_find_uploads_to_join_already_joined
Stack Traces | 0.031s run time
self = <sqlalchemy.engine.base.Connection object at 0x7ff4d7689190>
dialect = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2'>>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
args = (<sqlalchemy.dialects.postgresql.psycopg2.PGCompiler_psycopg2 object at 0x7ff4d635f240>, [{'normalized_at': datetime.d..., tzinfo=datetime.timezone.utc), 'normalized_location': None, 'profiling_commit_id': 19, 'raw_upload_location': None}])
conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x7ff4d5c80b50>
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def _execute_context(
        self, dialect, constructor, statement, parameters, *args
    ):
        """Create an :class:`.ExecutionContext` and execute, returning
        a :class:`_engine.ResultProxy`.
    
        """
    
        try:
            try:
                conn = self.__connection
            except AttributeError:
                # escape "except AttributeError" before revalidating
                # to prevent misleading stacktraces in Py3K
                conn = None
            if conn is None:
                conn = self._revalidate_connection()
    
            context = constructor(dialect, self, conn, *args)
        except BaseException as e:
            self._handle_dbapi_exception(
                e, util.text_type(statement), parameters, None, None
            )
    
        if context.compiled:
            context.pre_exec()
    
        cursor, statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        if not context.executemany:
            parameters = parameters[0]
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                statement, parameters = fn(
                    self,
                    cursor,
                    statement,
                    parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self.engine.logger.info(statement)
            if not self.engine.hide_parameters:
                self.engine.logger.info(
                    "%r",
                    sql_util._repr_params(
                        parameters, batches=10, ismulti=context.executemany
                    ),
                )
            else:
                self.engine.logger.info(
                    "[SQL parameters hidden due to hide_parameters=True]"
                )
    
        evt_handled = False
        try:
            if context.executemany:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor, statement, parameters, context
                    )
            elif not parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, statement, context
                    )
            else:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(cursor, statement, parameters, context):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, statement, parameters, context
                    )

.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4f48d5e40; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.errors.NotNullViolation: null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (9, 0ea822d8-5893-457a-9851-3907d9674404, 2025-01-10 12:35:23.104998+00, 2025-01-10 12:35:23.105003+00, null, 19, 2021-05-01 01:01:01+00, null).

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: NotNullViolation

The above exception was the direct cause of the following exception:

self = <worker.tasks.tests.unit.test_profiling_collection.TestProfilingCollectionTask object at 0x7ff504596050>
dbsession = <sqlalchemy.orm.session.Session object at 0x7ff4f48d5b80>

    def test_find_uploads_to_join_already_joined(self, dbsession):
        before = datetime(2021, 5, 1, 4, 0, 0).replace(tzinfo=timezone.utc)
        task = ProfilingCollectionTask()
        pcf = ProfilingCommitFactory.create(
            last_joined_uploads_at=datetime(2021, 5, 1, 1, 2, 3)
        )
        dbsession.add(pcf)
        dbsession.flush()
        first_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 1, 1, 1).replace(tzinfo=timezone.utc),
        )
        second_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 1, 30, 0).replace(tzinfo=timezone.utc),
        )
        third_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 2, 1, 0).replace(tzinfo=timezone.utc),
        )
        fourth_pu = ProfilingUploadFactory.create(
            profiling_commit=pcf,
            normalized_at=datetime(2021, 5, 1, 4, 12, 14).replace(tzinfo=timezone.utc),
        )
        dbsession.add(first_pu)
        dbsession.add(second_pu)
        dbsession.add(third_pu)
        dbsession.add(fourth_pu)
>       res, when = task.find_uploads_to_join(pcf, before)

.../tests/unit/test_profiling_collection.py:570: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../local/lib/python3.13.../statsd/client/timer.py:38: in _wrapped
    return f(*args, **kwargs)
tasks/profiling_collection.py:105: in find_uploads_to_join
    .first()
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3429: in first
    ret = list(self[0:1])
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3203: in __getitem__
    return list(res)
.../local/lib/python3.13.../sqlalchemy/orm/query.py:3534: in __iter__
    self.session._autoflush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1633: in _autoflush
    util.raise_(e, with_traceback=sys.exc_info()[2])
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:1622: in _autoflush
    self.flush()
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2540: in flush
    self._flush(objects)
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2681: in _flush
    with util.safe_reraise():
.../local/lib/python3.13.../sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/orm/session.py:2642: in _flush
    flush_context.execute()
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:422: in execute
    rec.execute(self)
.../local/lib/python3.13.../sqlalchemy/orm/unitofwork.py:586: in execute
    persistence.save_obj(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:239: in save_obj
    _emit_insert_statements(
.../local/lib/python3.13.../sqlalchemy/orm/persistence.py:1135: in _emit_insert_statements
    result = cached_connections[connection].execute(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1011: in execute
    return meth(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/sql/elements.py:298: in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1124: in _execute_clauseelement
    ret = self._execute_context(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1316: in _execute_context
    self._handle_dbapi_exception(
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1510: in _handle_dbapi_exception
    util.raise_(
.../local/lib/python3.13.../sqlalchemy/util/compat.py:182: in raise_
    raise exception
.../local/lib/python3.13.../sqlalchemy/engine/base.py:1276: in _execute_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7ff4fce3c7d0>
cursor = <cursor object at 0x7ff4f48d5e40; closed: -1>
statement = 'INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id,...ocation)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id'
parameters = {'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'external_id': UUID('...normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None, ...}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7ff4f48d73e0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
E       (psycopg2.errors.NotNullViolation) null value in column "raw_upload_location" of relation "profiling_profilingupload" violates not-null constraint
E       DETAIL:  Failing row contains (9, 0ea822d8-5893-457a-9851-3907d9674404, 2025-01-10 12:35:23.104998+00, 2025-01-10 12:35:23.105003+00, null, 19, 2021-05-01 01:01:01+00, null).
E       
E       [SQL: INSERT INTO profiling_profilingupload (external_id, created_at, updated_at, raw_upload_location, profiling_commit_id, normalized_at, normalized_location) VALUES (%(external_id)s, %(created_at)s, %(updated_at)s, %(raw_upload_location)s, %(profiling_commit_id)s, %(normalized_at)s, %(normalized_location)s) RETURNING profiling_profilingupload.id]
E       [parameters: {'external_id': UUID('0ea822d8-5893-457a-9851-3907d9674404'), 'created_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 104998, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2025, 1, 10, 12, 35, 23, 105003, tzinfo=datetime.timezone.utc), 'raw_upload_location': None, 'profiling_commit_id': 19, 'normalized_at': datetime.datetime(2021, 5, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), 'normalized_location': None}]
E       (Background on this error at: http://sqlalche..../e/13/gkpj)

.../local/lib/python3.13.../sqlalchemy/engine/default.py:608: IntegrityError
tests/unit/test_task_router.py::::test_get_user_plan_from_profiling_upload
Stack Traces | 0.034s run time
No failure message available
tests/unit/test_task_router.py::::test_get_user_plan_from_task
Stack Traces | 0.034s run time
No failure message available

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

github-actions bot commented Jan 10, 2025

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Copy link
Contributor

@adrian-codecov adrian-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants