parameters: (user_id:int, obj_id:int, table_name:str, cursor=None)
docstring: Determine whether the user with ID <user_id> imported the object with ID
      <obj_id> in table <table_name>. This is done by looking at the oldest known
      instance of this object and whether the respective transactin it was created
      in is a skeletons.import annotation. Therefore, this currently has only a
      meaning for objects related to a skeleton import.
docstring_summary: Determine whether the user with ID <user_id> imported the object with ID
      <obj_id> in table <table_name>. This is done by looking at the oldest known
      instance of this object and whether the respective transactin it was created
      in is a skeletons.import annotation. Therefore, this currently has only a
      meaning for objects related to a skeleton import.
docstring_tokens: Determine whether the user with ID <user_id > imported the object with ID <obj_id > in table <table_name > . This is done by looking at the oldest known instance of this object and whether the respective transactin it was created in is a skeletons . import annotation . Therefore this currently has only a meaning for objects related to a skeleton import .
function: def user_has_imported(user_id:int, obj_id:int, table_name:str, cursor=None) -> bool:
      """Determine whether the user with ID <user_id> imported the object with ID
      <obj_id> in table <table_name>. This is done by looking at the oldest known
      instance of this object and whether the respective transactin it was created
      in is a skeletons.import annotation. Therefore, this currently has only a
      meaning for objects related to a skeleton import.
      """
      if not re.match('^[a-z_]+$', table_name):
          raise Exception(f'Invalid table name: {table_name}')
      if not cursor:
          cursor = connection.cursor()
  
      try:
          # retrieve a row when the user_id belongs to a group with name equal to that associated with other_user_id
          cursor.execute(f"""
              SELECT 1
              FROM (
                  SELECT txid, edition_time
                  FROM {table_name}__with_history th
                  WHERE th.id = %(obj_id)s
                  ORDER BY edition_time ASC
                  LIMIT 1
              ) t_origin
              JOIN LATERAL (
                  SELECT 1
                  FROM catmaid_transaction_info cti
                  WHERE cti.transaction_id = t_origin.txid
                      -- Transaction ID wraparound match protection. A transaction
                      -- ID is only unique together with a date.
                      AND cti.execution_time = t_origin.edition_time
                      AND label = 'skeletons.import'
                      AND user_id = %(user_id)s
                  LIMIT 1
              ) t_origin_tx
                  ON TRUE
          """, {
              'obj_id': obj_id,
              'user_id': user_id,
          })
          return cursor.rowcount > 0
      except ProgrammingError as e:
          # In case of a non existent target table, we assume this table is
          # unsupported. This import check works currently only for tables with
          # history tracking.
          if '__with_history" does not exist' in e.message:
              return False
          raise
function_tokens: def user_has_imported ( user_id : int , obj_id : int , table_name : str , cursor = None ) -> bool : if not re . match ( '^[a-z_]+$' , table_name ) : raise Exception ( f'Invalid table name: {table_name}' ) if not cursor : cursor = connection . cursor ( ) try : # retrieve a row when the user_id belongs to a group with name equal to that associated with other_user_id cursor . execute ( f"""
              SELECT 1
              FROM (
                  SELECT txid, edition_time
                  FROM {table_name}__with_history th
                  WHERE th.id = %(obj_id)s
                  ORDER BY edition_time ASC
                  LIMIT 1
              ) t_origin
              JOIN LATERAL (
                  SELECT 1
                  FROM catmaid_transaction_info cti
                  WHERE cti.transaction_id = t_origin.txid
                      -- Transaction ID wraparound match protection. A transaction
                      -- ID is only unique together with a date.
                      AND cti.execution_time = t_origin.edition_time
                      AND label = 'skeletons.import'
                      AND user_id = %(user_id)s
                  LIMIT 1
              ) t_origin_tx
                  ON TRUE
          """ , { 'obj_id' : obj_id , 'user_id' : user_id , } ) return cursor . rowcount > 0 except ProgrammingError as e : # In case of a non existent target table, we assume this table is # unsupported. This import check works currently only for tables with # history tracking. if '__with_history" does not exist' in e . message : return False raise